@@ -8,6 +8,7 @@ window.devToolsExtension = function(next) {
88 let shouldSerialize = false ;
99 let shouldInit = true ;
1010 let actionsCount = 0 ;
11+ let errorOccurred = false ;
1112
1213 function relay ( type , state , action , nextActionId ) {
1314 const message = {
@@ -80,10 +81,11 @@ window.devToolsExtension = function(next) {
8081 setTimeout ( ( ) => {
8182 if ( action . type === 'PERFORM_ACTION' ) {
8283 actionsCount ++ ;
83- if ( isLimit ( ) || isFiltered ( action . action ) ) return state ;
84+ if ( isLimit ( ) || isFiltered ( action . action ) || errorOccurred ) return state ;
8485 relay ( 'ACTION' , store . getState ( ) , action , actionsCount ) ;
8586 } else {
8687 let liftedState = store . liftedStore . getState ( ) ;
88+ if ( errorOccurred && ! liftedState . computedStates [ liftedState . currentStateIndex ] . error ) errorOccurred = false ;
8789 addFilter ( liftedState ) ;
8890 relay ( 'STATE' , liftedState ) ;
8991 actionsCount = liftedState . nextActionId ;
@@ -95,7 +97,7 @@ window.devToolsExtension = function(next) {
9597
9698 function init ( ) {
9799 window . addEventListener ( 'message' , onMessage , false ) ;
98- window . devToolsExtension . notifyErrors ( ) ;
100+ window . devToolsExtension . notifyErrors ( store , relay , ( ) => { errorOccurred = true ; } ) ;
99101 }
100102
101103 if ( next ) {
@@ -125,9 +127,17 @@ window.devToolsExtension.open = function(position) {
125127 } , '*' ) ;
126128} ;
127129
128- // Catch non-reducer errors
129- window . devToolsExtension . notifyErrors = function ( ) {
130+ // Catch errors
131+ window . devToolsExtension . notifyErrors = function ( store , relay , onError ) {
130132 function postError ( message ) {
133+ if ( store && store . liftedStore && relay ) {
134+ const state = store . liftedStore . getState ( ) ;
135+ if ( state . computedStates [ state . currentStateIndex ] . error ) {
136+ relay ( 'STATE' , state ) ;
137+ if ( onError ) onError ( ) ;
138+ return ;
139+ }
140+ }
131141 window . postMessage ( {
132142 source : 'redux-page' ,
133143 type : 'ERROR' ,
0 commit comments