File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
packages/nextjs/src/performance Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -197,16 +197,18 @@ export function nextRouterInstrumentation(
197197 }
198198}
199199
200- function getNextRouteFromPathname ( pathname : string ) : string | void {
200+ function getNextRouteFromPathname ( pathname : string ) : string | undefined {
201201 const pageRoutes = ( global . __BUILD_MANIFEST || { } ) . sortedPages ;
202202
203203 // Page route should in 99.999% of the cases be defined by now but just to be sure we make a check here
204- if ( pageRoutes ) {
205- return pageRoutes . find ( route => {
206- const routeRegExp = convertNextRouteToRegExp ( route ) ;
207- return pathname . match ( routeRegExp ) ;
208- } ) ;
204+ if ( ! pageRoutes ) {
205+ return ;
209206 }
207+
208+ return pageRoutes . find ( route => {
209+ const routeRegExp = convertNextRouteToRegExp ( route ) ;
210+ return pathname . match ( routeRegExp ) ;
211+ } ) ;
210212}
211213
212214/**
You can’t perform that action at this time.
0 commit comments