Skip to content

Commit a32a163

Browse files
committed
don't block hot updates while waiting for types
1 parent 6d2265d commit a32a163

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

packages/react-dev-utils/WebpackDevServerUtils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ function createCompiler(
224224
// We have to notify the hot dev client when we are waiting for types
225225
// when `module.hot` is being used.
226226
devSocketWrite('wait-for-types', false);
227-
devSocketWrite('ok');
227+
devSocketWrite('dismiss-build-error');
228228
}
229229

230230
isFirstCompile = false;

packages/react-dev-utils/webpackHotDevClient.js

+14-3
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function handleSuccess() {
107107
tryApplyUpdates(function onHotUpdateSuccess() {
108108
// Only dismiss it when we're sure it's a hot update.
109109
// Otherwise it would flicker right before the reload.
110-
ErrorOverlay.dismissBuildError();
110+
dismissBuildErrorIFNotWaiting();
111111
});
112112
}
113113
}
@@ -148,7 +148,7 @@ function handleWarnings(warnings) {
148148
tryApplyUpdates(function onSuccessfulHotUpdate() {
149149
// Only dismiss it when we're sure it's a hot update.
150150
// Otherwise it would flicker right before the reload.
151-
ErrorOverlay.dismissBuildError();
151+
dismissBuildErrorIFNotWaiting();
152152
});
153153
}
154154
}
@@ -186,6 +186,14 @@ function handleAvailableHash(hash) {
186186
mostRecentCompilationHash = hash;
187187
}
188188

189+
function dismissBuildErrorIFNotWaiting() {
190+
if (isWaitingForTypes) {
191+
return;
192+
}
193+
194+
ErrorOverlay.dismissBuildError();
195+
}
196+
189197
// Handle messages from the server.
190198
connection.onmessage = function(e) {
191199
var message = JSON.parse(e.data);
@@ -207,6 +215,9 @@ connection.onmessage = function(e) {
207215
case 'wait-for-types':
208216
isWaitingForTypes = message.data;
209217
break;
218+
case 'dismiss-build-error':
219+
ErrorOverlay.dismissBuildError();
220+
break;
210221
case 'errors':
211222
handleErrors(message.data);
212223
break;
@@ -225,7 +236,7 @@ function isUpdateAvailable() {
225236

226237
// Webpack disallows updates in other states.
227238
function canApplyUpdates() {
228-
return module.hot.status() === 'idle' && !isWaitingForTypes;
239+
return module.hot.status() === 'idle';
229240
}
230241

231242
// Attempt to update code on the fly, fall back to a hard reload.

0 commit comments

Comments
 (0)