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