Skip to content

Commit

Permalink
Merge pull request #3315 from weaveworks/fix-update-storage-state
Browse files Browse the repository at this point in the history
Update localStorage with Scope state also on initial router hook
  • Loading branch information
fbarl authored Aug 14, 2018
2 parents 57a7e55 + af99a95 commit 49d8ca9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions client/app/scripts/utils/router-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 49d8ca9

Please sign in to comment.