From 682901fe584a8bbcdfebb7ec5e84a0c94ee03d37 Mon Sep 17 00:00:00 2001 From: eps1lon Date: Fri, 19 Jul 2024 17:36:50 +0200 Subject: [PATCH] Revert "Work around existing bugs" There's really no right amount of time to wait for the HMR update. Need to fix the bug --- .../router-reducer/fetch-server-response.ts | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/packages/next/src/client/components/router-reducer/fetch-server-response.ts b/packages/next/src/client/components/router-reducer/fetch-server-response.ts index 1d00dfd926e50e..9bef27e10e93ad 100644 --- a/packages/next/src/client/components/router-reducer/fetch-server-response.ts +++ b/packages/next/src/client/components/router-reducer/fetch-server-response.ts @@ -193,19 +193,7 @@ export async function fetchServerResponse( isNavigation && !process.env.TURBOPACK ) { - const webpackHMRTimedOut = await Promise.race([ - waitForWebpackRuntimeHotUpdate().then(() => false), - new Promise((resolve) => setTimeout(() => resolve(true), 2000)), - ]) - - // Work around existing bugs where we receive an HMR update but no message that it was finished. - // Having the log before an MPA is pretty bad since it'll just flash the page and then navigate. - if (webpackHMRTimedOut) { - console.error( - 'Webpack runtime hot update timed out. Falling back to browser navigation.' - ) - return doMpaNavigation(responseUrl.toString()) - } + await waitForWebpackRuntimeHotUpdate() } // Handle the `fetch` readable stream that can be unwrapped by `React.use`.