Skip to content

Commit

Permalink
Dispose error overlay when linting errors have been corrected (#856)
Browse files Browse the repository at this point in the history
* Dispose error overlay when linting errors have been corrected

* Fixed spelling error

* Minor style tweaks
  • Loading branch information
jarlef authored and gaearon committed Oct 11, 2016
1 parent 1359cc4 commit 4e5a561
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/react-dev-utils/webpackHotDevClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,19 @@ function showErrorOverlay(message) {
});
}

function destroyErrorOverlay() {
if (!overlayDiv) {
// It is not there in the first place.
return;
}

// Clean up and reset internal state.
document.body.removeChild(overlayIframe);
overlayDiv = null;
overlayIframe = null;
lastOnOverlayDivReady = null;
}

// Connect to WebpackDevServer via a socket.
var connection = new SockJS(url.format({
protocol: window.location.protocol,
Expand Down Expand Up @@ -156,6 +169,7 @@ function clearOutdatedErrors() {
// Successful compilation.
function handleSuccess() {
clearOutdatedErrors();
destroyErrorOverlay();

var isHotUpdate = !isFirstCompilation;
isFirstCompilation = false;
Expand All @@ -170,6 +184,7 @@ function handleSuccess() {
// Compilation with warnings (e.g. ESLint).
function handleWarnings(warnings) {
clearOutdatedErrors();
destroyErrorOverlay();

var isHotUpdate = !isFirstCompilation;
isFirstCompilation = false;
Expand Down

0 comments on commit 4e5a561

Please sign in to comment.