Merge pull request #3315 from weaveworks/fix-update-storage-state

Update localStorage with Scope state also on initial router hook
This commit is contained in:
Filip Barl
2018-08-14 14:12:30 +02:00
committed by GitHub

View File

@@ -167,11 +167,11 @@ export function getRouter(dispatch, initialState) {
page('/state/:state', (ctx) => {
const state = JSON.parse(decodeURL(ctx.params.state));
const dirtyOptions = detectOldOptions(state.topologyOptions);
if (dirtyOptions) {
dispatch(route(initialState));
} else {
dispatch(route(state));
}
const nextState = dirtyOptions ? initialState : state;
// back up state in storage and redirect
storageSet(STORAGE_STATE_KEY, encodeURL(stableStringify(state)));
dispatch(route(nextState));
});
return page;