Skip to content

Commit 53b5021

Browse files
author
Luca Forstner
committed
avoid the void
1 parent cda4b9f commit 53b5021

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

packages/nextjs/src/performance/client.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff 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
/**

0 commit comments

Comments
 (0)