Skip to content

Commit 4e5a561

Browse files
jarlefgaearon
authored andcommitted
Dispose error overlay when linting errors have been corrected (#856)
* Dispose error overlay when linting errors have been corrected * Fixed spelling error * Minor style tweaks
1 parent 1359cc4 commit 4e5a561

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

packages/react-dev-utils/webpackHotDevClient.js

+15
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,19 @@ function showErrorOverlay(message) {
123123
});
124124
}
125125

126+
function destroyErrorOverlay() {
127+
if (!overlayDiv) {
128+
// It is not there in the first place.
129+
return;
130+
}
131+
132+
// Clean up and reset internal state.
133+
document.body.removeChild(overlayIframe);
134+
overlayDiv = null;
135+
overlayIframe = null;
136+
lastOnOverlayDivReady = null;
137+
}
138+
126139
// Connect to WebpackDevServer via a socket.
127140
var connection = new SockJS(url.format({
128141
protocol: window.location.protocol,
@@ -156,6 +169,7 @@ function clearOutdatedErrors() {
156169
// Successful compilation.
157170
function handleSuccess() {
158171
clearOutdatedErrors();
172+
destroyErrorOverlay();
159173

160174
var isHotUpdate = !isFirstCompilation;
161175
isFirstCompilation = false;
@@ -170,6 +184,7 @@ function handleSuccess() {
170184
// Compilation with warnings (e.g. ESLint).
171185
function handleWarnings(warnings) {
172186
clearOutdatedErrors();
187+
destroyErrorOverlay();
173188

174189
var isHotUpdate = !isFirstCompilation;
175190
isFirstCompilation = false;

0 commit comments

Comments
 (0)