mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 18:20:27 +00:00
Update localStorage with Scope state also on initial router hook.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user