@@ -25,6 +25,13 @@ const createConnectedRouter = (structure) => {
25
25
26
26
// Subscribe to store changes to check if we are in time travelling
27
27
this . unsubscribe = store . subscribe ( ( ) => {
28
+ // Allow time travel debugging compatibility to be turned off
29
+ // as the detection for this (below) is error prone in apps where the
30
+ // store may be unmounted, a navigation occurs, and then the store is re-mounted
31
+ // during the app's lifetime. Detection could be much improved if Redux DevTools
32
+ // simply set a global variable like `REDUX_DEVTOOLS_IS_TIME_TRAVELLING=true`.
33
+ const isTimeTravelDebuggingAllowed = ! props . noTimeTravelDebugging
34
+
28
35
// Extract store's location
29
36
const {
30
37
pathname : pathnameInStore ,
@@ -42,6 +49,7 @@ const createConnectedRouter = (structure) => {
42
49
43
50
// If we do time travelling, the location in store is changed but location in history is not changed
44
51
if (
52
+ isTimeTravelDebuggingAllowed &&
45
53
props . history . action === 'PUSH' &&
46
54
( pathnameInHistory !== pathnameInStore ||
47
55
searchInHistory !== searchInStore ||
@@ -118,6 +126,7 @@ const createConnectedRouter = (structure) => {
118
126
children : PropTypes . oneOfType ( [ PropTypes . func , PropTypes . node ] ) ,
119
127
onLocationChanged : PropTypes . func . isRequired ,
120
128
noInitialPop : PropTypes . bool ,
129
+ noTimeTravelDebugging : PropTypes . bool ,
121
130
stateCompareFunction : PropTypes . func ,
122
131
omitRouter : PropTypes . bool ,
123
132
}
0 commit comments