Skip to content
  • Sponsor facebook/create-react-app

  • Notifications You must be signed in to change notification settings
  • Fork 27k
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve interaction between compile and runtime overlays #2219

Merged
merged 1 commit into from
May 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions packages/react-dev-utils/webpackHotDevClient.js
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ function createOverlayIframe(onIframeLoad) {
iframe.style.width = '100vw';
iframe.style.height = '100vh';
iframe.style.border = 'none';
iframe.style.zIndex = 9999999999;
iframe.style.zIndex = 2147483647;
iframe.onload = onIframeLoad;
return iframe;
}
@@ -192,22 +192,24 @@ function clearOutdatedErrors() {
// Successful compilation.
function handleSuccess() {
clearOutdatedErrors();
destroyErrorOverlay();

var isHotUpdate = !isFirstCompilation;
isFirstCompilation = false;
hasCompileErrors = false;

// Attempt to apply hot updates or reload.
if (isHotUpdate) {
tryApplyUpdates();
tryApplyUpdates(function onHotUpdateSuccess() {
// Only destroy it when we're sure it's a hot update.
// Otherwise it would flicker right before the reload.
destroyErrorOverlay();
});
}
}

// Compilation with warnings (e.g. ESLint).
function handleWarnings(warnings) {
clearOutdatedErrors();
destroyErrorOverlay();

var isHotUpdate = !isFirstCompilation;
isFirstCompilation = false;
@@ -231,6 +233,9 @@ function handleWarnings(warnings) {
// Only print warnings if we aren't refreshing the page.
// Otherwise they'll disappear right away anyway.
printWarnings();
// Only destroy it when we're sure it's a hot update.
// Otherwise it would flicker right before the reload.
destroyErrorOverlay();
});
} else {
// Print initial warnings immediately.
2 changes: 1 addition & 1 deletion packages/react-error-overlay/src/styles.js
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ const iframeStyle = {
width: '100%',
height: '100%',
border: 'none',
'z-index': 1337,
'z-index': 2147483647 - 1, // below the compile error overlay
};

const overlayStyle = {