diff --git a/client/app/scripts/utils/router-utils.js b/client/app/scripts/utils/router-utils.js index 66ba02077..6bc7d330c 100644 --- a/client/app/scripts/utils/router-utils.js +++ b/client/app/scripts/utils/router-utils.js @@ -90,20 +90,21 @@ export function updateRoute(getState) { export function getRouter(dispatch, initialState) { - let mergedState = initialState; // strip any trailing '/'s. page.base(window.location.pathname.replace(/\/$/, '')); - const storageState = storageGet(STORAGE_STATE_KEY); - if (storageState) { - window.location.hash = `!/state/${storageState}`; - const parsedState = JSON.parse(decodeURL(storageState)); - mergedState = { ...initialState, ...parsedState }; - } - page('/', () => { // recover from storage state on empty URL - dispatch(route(mergedState)); + const storageState = storageGet(STORAGE_STATE_KEY); + if (storageState) { + // push storage state to URL + window.location.hash = `!/state/${storageState}`; + const parsedState = JSON.parse(decodeURL(storageState)); + const mergedState = Object.assign(initialState, parsedState); + dispatch(route(mergedState)); + } else { + dispatch(route(initialState)); + } }); page('/state/:state', (ctx) => {