salvoravida/redux-first-history

Add an option to provide an initial state for the reducer?

mggower opened this issue · 2 comments

it would be convenient to be able to provide this initial state for the router reducer to avoid having to null check consistently

it would be convenient to be able to provide this initial state for the router reducer to avoid having to null check consistently

Hi, the state is initialized with history location as soon as the reduxHistory object is created
https://github.com/salvoravida/redux-first-history/blob/master/src/create.ts#L91

Until that, it is correct that the state is not in sync with the history object

Wanted to throw up this use case, because it doesnt seem possible to provide the initial state.

For our app we would like to set the initial state when deeplinking to a page.
Because the default state is using the history object it will link outside the application when we use the GoBack action.
Instead we would like to have an intitial state that references to the root of our app.