Skip to content

Commit bc9e932

Browse files
committed
Only await Webpack Runtime update outside of prefetches
1 parent da4c84a commit bc9e932

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/next/src/client/components/router-reducer/fetch-server-response.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,14 @@ export async function fetchServerResponse(
6969
}
7070

7171
/**
72-
* Three cases:
72+
* Four cases:
7373
* - `prefetchKind` is `undefined`, it means it's a normal navigation, so we want to prefetch the page data fully
74+
* - `prefetchKind` is `temporary` - it means it's a normal navigation, so we want to prefetch the page data fully
7475
* - `prefetchKind` is `full` - we want to prefetch the whole page so same as above
7576
* - `prefetchKind` is `auto` - if the page is dynamic, prefetch the page data partially, if static prefetch the page data fully
7677
*/
78+
const isNavigation =
79+
prefetchKind === undefined || prefetchKind === PrefetchKind.TEMPORARY
7780
if (prefetchKind === PrefetchKind.AUTO) {
7881
headers[NEXT_ROUTER_PREFETCH_HEADER] = '1'
7982
}
@@ -157,7 +160,7 @@ export async function fetchServerResponse(
157160
// In prod, every page will have the same Webpack runtime.
158161
// In dev, the Webpack runtime is minimal for each page.
159162
// We need to ensure the Webpack runtime is updated before executing client-side JS of the new page.
160-
if (process.env.NODE_ENV !== 'production') {
163+
if (process.env.NODE_ENV !== 'production' && isNavigation) {
161164
await waitForWebpackRuntimeHotUpdate()
162165
}
163166

0 commit comments

Comments
 (0)