mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-29 01:45:40 +08:00
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
This commit is contained in:
committed by
Dan Abramov
parent
1359cc492c
commit
4e5a561d98
15
packages/react-dev-utils/webpackHotDevClient.js
vendored
15
packages/react-dev-utils/webpackHotDevClient.js
vendored
@@ -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.
|
// Connect to WebpackDevServer via a socket.
|
||||||
var connection = new SockJS(url.format({
|
var connection = new SockJS(url.format({
|
||||||
protocol: window.location.protocol,
|
protocol: window.location.protocol,
|
||||||
@@ -156,6 +169,7 @@ function clearOutdatedErrors() {
|
|||||||
// Successful compilation.
|
// Successful compilation.
|
||||||
function handleSuccess() {
|
function handleSuccess() {
|
||||||
clearOutdatedErrors();
|
clearOutdatedErrors();
|
||||||
|
destroyErrorOverlay();
|
||||||
|
|
||||||
var isHotUpdate = !isFirstCompilation;
|
var isHotUpdate = !isFirstCompilation;
|
||||||
isFirstCompilation = false;
|
isFirstCompilation = false;
|
||||||
@@ -170,6 +184,7 @@ function handleSuccess() {
|
|||||||
// Compilation with warnings (e.g. ESLint).
|
// Compilation with warnings (e.g. ESLint).
|
||||||
function handleWarnings(warnings) {
|
function handleWarnings(warnings) {
|
||||||
clearOutdatedErrors();
|
clearOutdatedErrors();
|
||||||
|
destroyErrorOverlay();
|
||||||
|
|
||||||
var isHotUpdate = !isFirstCompilation;
|
var isHotUpdate = !isFirstCompilation;
|
||||||
isFirstCompilation = false;
|
isFirstCompilation = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user