fix missed hmr events (#30309)

When an compilation happens in the timespan between "page loaded client bundle" and "web socket got initial sync event" it didn't apply the hmr update.
This commit is contained in:
Tobias Koppers 2021-10-26 20:06:29 +02:00 committed by GitHub
parent d8e74a8490
commit 520c5a4083
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,6 +35,7 @@ import {
import stripAnsi from 'next/dist/compiled/strip-ansi'
import { addMessageListener } from './websocket'
import formatWebpackMessages from './format-webpack-messages'
import Router from 'next/router'
// This alternative WebpackDevServer combines the functionality of:
// https://github.com/webpack/webpack-dev-server/blob/webpack-1/client/index.js
@ -88,7 +89,9 @@ function clearOutdatedErrors() {
function handleSuccess() {
clearOutdatedErrors()
const isHotUpdate = !isFirstCompilation
const isHotUpdate =
!isFirstCompilation ||
(Router.pathname !== '/_error' && isUpdateAvailable())
isFirstCompilation = false
hasCompileErrors = false