File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ let firstRender = false;
5
5
let oldArgs : any = { } ;
6
6
7
7
const useContextDevTools = ( dispatch : Function ) => {
8
- if ( ! isInitialized ) {
8
+ if ( ! isInitialized && ( window as any ) . __REDUX_DEVTOOLS_EXTENSION__ ) {
9
9
devTools . current = ( window as any ) . __REDUX_DEVTOOLS_EXTENSION__ . connect ( {
10
10
features : {
11
11
pause : true , // start/pause recording of dispatched actions
@@ -54,18 +54,22 @@ const useContextDevTools = (dispatch: Function) => {
54
54
} ;
55
55
56
56
const sendUpdatedState = ( updatedState : any ) => {
57
- if ( ! firstRender ) {
58
- devTools . current . init ( updatedState ) ;
59
- firstRender = true ;
60
- } else {
61
- if ( oldArgs . type !== 'IMPORT_STATE' ) {
62
- devTools . current . send ( oldArgs , updatedState ) ;
57
+ if ( ( window as any ) . __REDUX_DEVTOOLS_EXTENSION__ ) {
58
+ if ( ! firstRender ) {
59
+ devTools . current . init ( updatedState ) ;
60
+ firstRender = true ;
61
+ } else {
62
+ if ( oldArgs . type !== 'IMPORT_STATE' ) {
63
+ devTools . current . send ( oldArgs , updatedState ) ;
64
+ }
63
65
}
64
66
}
65
67
} ;
66
68
67
69
const disconnectDevTools = ( ) => {
68
- return typeof devTools ?. current ?. disconnect === 'function' && devTools ?. current ?. disconnect ( ) ;
70
+ if ( ( window as any ) . __REDUX_DEVTOOLS_EXTENSION__ ) {
71
+ return typeof devTools ?. current ?. disconnect === 'function' && devTools ?. current ?. disconnect ( ) ;
72
+ }
69
73
}
70
74
71
75
return {
You can’t perform that action at this time.
0 commit comments