Skip to content

Commit e0fc2a7

Browse files
committed
fix: actually measure how long loadChunk takes
1 parent db45841 commit e0fc2a7

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

packages/next/src/server/app-render/action-handler.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,10 @@ export async function handleAction({
915915
}
916916

917917
const actionHandler = (
918-
await ComponentMod.__next_app__.require(actionModId)
918+
(await ComponentMod.__next_app__.require(actionModId)) as Record<
919+
string,
920+
(...args: unknown[]) => Promise<unknown>
921+
>
919922
)[
920923
// `actionId` must exist if we got here, as otherwise we would have thrown an error above
921924
actionId!

packages/next/src/server/client-component-renderer-logger.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ export function wrapClientComponentLoader(
2929
},
3030
loadChunk: (...args) => {
3131
const startTime = performance.now()
32-
try {
33-
return ComponentMod.__next_app__.loadChunk(...args)
34-
} finally {
32+
const result = ComponentMod.__next_app__.loadChunk(...args)
33+
result.finally(() => {
3534
clientComponentLoadTimes += performance.now() - startTime
36-
}
35+
})
36+
return result
3737
},
3838
}
3939
}

0 commit comments

Comments
 (0)