summaryrefslogtreecommitdiffhomepage
path: root/gui/src
diff options
context:
space:
mode:
authorHank <hank@mullvad.net>2022-09-15 12:09:37 +0200
committerHank <hank@mullvad.net>2022-09-20 11:34:21 +0200
commit1ef6319d1969cf74584d9641a367cdbf6a5c2472 (patch)
treedb0dd0e6d543a4605941e600d5defa36e234adb6 /gui/src
parent5cd0b08fea12c14a81063607dabe4d72e041c66c (diff)
downloadmullvadvpn-1ef6319d1969cf74584d9641a367cdbf6a5c2472.tar.xz
mullvadvpn-1ef6319d1969cf74584d9641a367cdbf6a5c2472.zip
Simplify expression
Diffstat (limited to 'gui/src')
-rw-r--r--gui/src/renderer/redux/store.ts17
1 files changed, 11 insertions, 6 deletions
diff --git a/gui/src/renderer/redux/store.ts b/gui/src/renderer/redux/store.ts
index cd343883e7..9634774038 100644
--- a/gui/src/renderer/redux/store.ts
+++ b/gui/src/renderer/redux/store.ts
@@ -1,6 +1,6 @@
import { useRef } from 'react';
import { useSelector as useReduxSelector } from 'react-redux';
-import { combineReducers, compose, createStore, Dispatch } from 'redux';
+import { combineReducers, compose, createStore, Dispatch, StoreEnhancer } from 'redux';
import { useWillExit } from '../lib/will-exit';
import accountActions, { AccountAction } from './account/actions';
@@ -50,7 +50,7 @@ export default function configureStore() {
return createStore(rootReducer, composeEnhancers());
}
-function composeEnhancers(): typeof compose {
+function composeEnhancers(): StoreEnhancer {
const actionCreators = {
...accountActions,
...connectionActions,
@@ -60,10 +60,15 @@ function composeEnhancers(): typeof compose {
...userInterfaceActions,
};
- return window.env.development
- ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
- (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?.({ actionCreators })() ?? compose()
- : compose();
+ if (window.env.development) {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const devtoolsCompose = (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?.({
+ actionCreators,
+ });
+ return devtoolsCompose ? devtoolsCompose() : compose();
+ }
+
+ return compose();
}
// This hook adds type to state to make use simpler. It also prevents the state from update if the