Skip to content

Commit

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

* Dispose error overlay when linting errors have been corrected

* Fixed spelling error

* Minor style tweaks
  • Loading branch information
jarlef authored and feiqitian committed Oct 25, 2016
1 parent 4f9a803 commit 31d2b99
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 31d2b99

Please sign in to comment.