Skip to content

Commit

Permalink
Update default instances state
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Jul 25, 2023
1 parent 80d964c commit b22c364
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 9 additions & 1 deletion app/store/configureStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 };
};

0 comments on commit b22c364

Please sign in to comment.