Skip to content
Merged
Changes from 1 commit
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
15 changes: 12 additions & 3 deletions packages/react-dev-utils/webpackHotDevClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,18 @@ var ErrorOverlay = require('react-error-overlay');
ErrorOverlay.startReportingRuntimeErrors({
launchEditorEndpoint: launchEditorEndpoint,
onError: function() {
// TODO: why do we need this?
if (module.hot && typeof module.hot.decline === 'function') {
module.hot.decline();
// Ensure HotModuleReplacementPlugin is active
if (module.hot && typeof module.hot.addStatusHandler === 'function') {
// When a run time error occurs, it does not make sense to continue HMR;
// as application state may be corrupted.
// So, next time we check for updates, simply reload the page (to
// abort the process).
// See https://github.com/facebookincubator/create-react-app/issues/3096
module.hot.addStatusHandler(function(status) {
if (status === 'check') {
window.location.reload();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effectively, if (err || !updatedModules || hadRuntimeError) {.

}
});
}
},
filename: '/static/js/bundle.js',
Expand Down