refactor: mark initial state as stale to determine when to rehydrate (#23)

This commit is contained in:
Satyajit Sahoo
2019-07-22 23:21:56 +02:00
committed by Michał Osadnik
parent 2798c93e8b
commit bd6aa667cb
9 changed files with 71 additions and 19 deletions

View File

@@ -86,9 +86,10 @@ const StackRouter: Router<CommonAction | Action> = {
getRehydratedState({ routeNames, partialState }) {
let state = partialState;
if (state.routeNames === undefined || state.key === undefined) {
if (state.stale) {
state = {
...state,
stale: false,
routeNames,
key: `stack-${shortid()}`,
};