From b22c3643682effd0061b8e31dfd02bc1a903595e Mon Sep 17 00:00:00 2001 From: jhen Date: Tue, 25 Jul 2023 12:43:53 +0800 Subject: [PATCH] Update default instances state --- app/index.js | 1 + app/store/configureStore.js | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/index.js b/app/index.js index 85e41a79..42fff3d3 100644 --- a/app/index.js +++ b/app/index.js @@ -34,6 +34,7 @@ let store; let persistor; const handleReady = () => { const { defaultReactDevToolsPort = 19567 } = config; + window.store = store; findAPortNotInUse(Number(defaultReactDevToolsPort)).then(port => { window.reactDevToolsPort = port; render( diff --git a/app/store/configureStore.js b/app/store/configureStore.js index 586f3dfd..a2506870 100644 --- a/app/store/configureStore.js +++ b/app/store/configureStore.js @@ -2,6 +2,7 @@ import { createStore, applyMiddleware, compose } from 'redux'; import { persistReducer, persistStore } from 'redux-persist'; import localForage from 'localforage'; import { exportStateMiddleware } from '@redux-devtools/app/lib/cjs/middlewares/exportState'; +import { instancesInitialState } from '@redux-devtools/app/lib/esm/reducers/instances'; import debuggerAPI from '../middlewares/debuggerAPI'; import reduxAPI from '../middlewares/reduxAPI'; import rootReducer from '../reducers'; @@ -26,8 +27,15 @@ const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; /* eslint-enable no-underscore-dangle */ const enhancer = composeEnhancers(middlewares); +const initialState = { + instances: { + ...instancesInitialState, + selected: '', + }, +}; + export default (callback) => { - const store = createStore(persistedReducer, undefined, enhancer); + const store = createStore(persistedReducer, initialState, enhancer); const persistor = persistStore(store, null, () => callback?.(store)); return { store, persistor }; };