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;
55let oldArgs : any = { } ;
66
77const useContextDevTools = ( dispatch : Function ) => {
8- if ( ! isInitialized ) {
8+ if ( ! isInitialized && ( window as any ) . __REDUX_DEVTOOLS_EXTENSION__ ) {
99 devTools . current = ( window as any ) . __REDUX_DEVTOOLS_EXTENSION__ . connect ( {
1010 features : {
1111 pause : true , // start/pause recording of dispatched actions
@@ -54,18 +54,22 @@ const useContextDevTools = (dispatch: Function) => {
5454 } ;
5555
5656 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+ }
6365 }
6466 }
6567 } ;
6668
6769 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+ }
6973 }
7074
7175 return {
You can’t perform that action at this time.
0 commit comments