diff options
Diffstat (limited to 'packages/instant/src/redux/store.ts')
-rw-r--r-- | packages/instant/src/redux/store.ts | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/packages/instant/src/redux/store.ts b/packages/instant/src/redux/store.ts index b9ce9c0c1..505234299 100644 --- a/packages/instant/src/redux/store.ts +++ b/packages/instant/src/redux/store.ts @@ -2,6 +2,17 @@ import * as _ from 'lodash'; import { createStore, Store as ReduxStore } from 'redux'; import { devToolsEnhancer } from 'redux-devtools-extension/developmentOnly'; -import { reducer, State } from './reducer'; +import { INITIAL_STATE, reducer, State } from './reducer'; + +export type Store = ReduxStore<State>; + +export const store = { + create: (withState: Partial<State>): Store => { + const allInitialState = { + INITIAL_STATE, + ...withState, + }; + return createStore(reducer, allInitialState, devToolsEnhancer({})); + }, +}; -export const store: ReduxStore<State> = createStore(reducer, devToolsEnhancer({})); |