Skip to content

Commit 44edb84

Browse files
committed
feat(getState): allow optional intialState argument
1 parent 01c2811 commit 44edb84

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/helpers/getState.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import getAction from './getAction';
22
import { resolveActionCreator } from './resolveActionCreator';
33

4-
const getState = ( url, routes, reducer ) => new Promise(( resolve, reject ) => {
4+
const getState = ( url, routes, reducer, initialState = {}) => new Promise(( resolve, reject ) => {
55
const actionCreatorsReducer = ( state, actionCreators ) => new Promise(( res, rej ) => {
66
if ( actionCreators.length ) {
77
const actionCreator = actionCreators.shift();
@@ -19,7 +19,7 @@ const getState = ( url, routes, reducer ) => new Promise(( resolve, reject ) =>
1919
});
2020

2121
getAction( url, routes ).then( action => {
22-
const state = reducer({}, action );
22+
const state = reducer( initialState, action );
2323

2424
if ( action.after.length ) {
2525
actionCreatorsReducer( state, action.after )

0 commit comments

Comments
 (0)