From 8c1816467facd84813ed8ee454c2340845695983 Mon Sep 17 00:00:00 2001 From: Jarle Friestad Date: Wed, 5 Oct 2016 21:44:18 +0200 Subject: [PATCH 1/3] Dispose error overlay when linting errors have been corrected --- packages/react-dev-utils/webpackHotDevClient.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/react-dev-utils/webpackHotDevClient.js b/packages/react-dev-utils/webpackHotDevClient.js index eebf6c0a254..9b2675121e2 100644 --- a/packages/react-dev-utils/webpackHotDevClient.js +++ b/packages/react-dev-utils/webpackHotDevClient.js @@ -123,6 +123,18 @@ function showErrorOverlay(message) { }); } +function destoryOverlay() { + if(!overlayDiv) { + //linting from previous linting was successful + return; + } + + 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, @@ -156,6 +168,7 @@ function clearOutdatedErrors() { // Successful compilation. function handleSuccess() { clearOutdatedErrors(); + destoryOverlay(); var isHotUpdate = !isFirstCompilation; isFirstCompilation = false; @@ -170,6 +183,7 @@ function handleSuccess() { // Compilation with warnings (e.g. ESLint). function handleWarnings(warnings) { clearOutdatedErrors(); + destoryOverlay(); var isHotUpdate = !isFirstCompilation; isFirstCompilation = false; From 15672aca5aa5ecc844c1344eb3d060b484dab4ac Mon Sep 17 00:00:00 2001 From: Jarle Friestad Date: Mon, 10 Oct 2016 08:52:25 +0200 Subject: [PATCH 2/3] Fixed spelling error --- packages/react-dev-utils/webpackHotDevClient.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react-dev-utils/webpackHotDevClient.js b/packages/react-dev-utils/webpackHotDevClient.js index 9b2675121e2..3368ef0a43b 100644 --- a/packages/react-dev-utils/webpackHotDevClient.js +++ b/packages/react-dev-utils/webpackHotDevClient.js @@ -123,7 +123,7 @@ function showErrorOverlay(message) { }); } -function destoryOverlay() { +function destroyOverlay() { if(!overlayDiv) { //linting from previous linting was successful return; @@ -168,7 +168,7 @@ function clearOutdatedErrors() { // Successful compilation. function handleSuccess() { clearOutdatedErrors(); - destoryOverlay(); + destroyOverlay(); var isHotUpdate = !isFirstCompilation; isFirstCompilation = false; @@ -183,7 +183,7 @@ function handleSuccess() { // Compilation with warnings (e.g. ESLint). function handleWarnings(warnings) { clearOutdatedErrors(); - destoryOverlay(); + destroyOverlay(); var isHotUpdate = !isFirstCompilation; isFirstCompilation = false; From 34c739bdf7a17c599cbc4995ed5e659ee0de3e11 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Tue, 11 Oct 2016 12:44:46 +0100 Subject: [PATCH 3/3] Minor style tweaks --- packages/react-dev-utils/webpackHotDevClient.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/react-dev-utils/webpackHotDevClient.js b/packages/react-dev-utils/webpackHotDevClient.js index 3368ef0a43b..f15fd06f291 100644 --- a/packages/react-dev-utils/webpackHotDevClient.js +++ b/packages/react-dev-utils/webpackHotDevClient.js @@ -123,12 +123,13 @@ function showErrorOverlay(message) { }); } -function destroyOverlay() { - if(!overlayDiv) { - //linting from previous linting was successful +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; @@ -168,7 +169,7 @@ function clearOutdatedErrors() { // Successful compilation. function handleSuccess() { clearOutdatedErrors(); - destroyOverlay(); + destroyErrorOverlay(); var isHotUpdate = !isFirstCompilation; isFirstCompilation = false; @@ -183,7 +184,7 @@ function handleSuccess() { // Compilation with warnings (e.g. ESLint). function handleWarnings(warnings) { clearOutdatedErrors(); - destroyOverlay(); + destroyErrorOverlay(); var isHotUpdate = !isFirstCompilation; isFirstCompilation = false;