File tree 1 file changed +9
-5
lines changed
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -25,13 +25,17 @@ var launchEditorEndpoint = require('./launchEditorEndpoint');
25
25
var formatWebpackMessages = require ( './formatWebpackMessages' ) ;
26
26
var ErrorOverlay = require ( 'react-error-overlay' ) ;
27
27
28
+ // We need to keep track of if there has been a runtime error.
29
+ // Essentially, we cannot guarantee application state was not corrupted by the
30
+ // runtime error. To prevent confusing behavior, we forcibly reload the entire
31
+ // application. This is handled below when we are notified of a compile (code
32
+ // change).
33
+ // See https://github.com/facebookincubator/create-react-app/issues/3096
34
+ var hadRuntimeError = false ;
28
35
ErrorOverlay . startReportingRuntimeErrors ( {
29
36
launchEditorEndpoint : launchEditorEndpoint ,
30
37
onError : function ( ) {
31
- // TODO: why do we need this?
32
- if ( module . hot && typeof module . hot . decline === 'function' ) {
33
- module . hot . decline ( ) ;
34
- }
38
+ hadRuntimeError = true ;
35
39
} ,
36
40
filename : '/static/js/bundle.js' ,
37
41
} ) ;
@@ -227,7 +231,7 @@ function tryApplyUpdates(onHotUpdateSuccess) {
227
231
}
228
232
229
233
function handleApplyUpdates ( err , updatedModules ) {
230
- if ( err || ! updatedModules ) {
234
+ if ( err || ! updatedModules || hadRuntimeError ) {
231
235
window . location . reload ( ) ;
232
236
return ;
233
237
}
You can’t perform that action at this time.
0 commit comments