From 5053f816e654e9b005444dceccf29009c8e3cae7 Mon Sep 17 00:00:00 2001 From: jpellizzari Date: Wed, 17 May 2017 13:40:23 -0700 Subject: [PATCH] Removed old url options workaround --- client/app/scripts/utils/router-utils.js | 34 +++--------------------- 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/client/app/scripts/utils/router-utils.js b/client/app/scripts/utils/router-utils.js index ce35ca468..3198cb3b3 100644 --- a/client/app/scripts/utils/router-utils.js +++ b/client/app/scripts/utils/router-utils.js @@ -1,5 +1,4 @@ import page from 'page'; -import { each } from 'lodash'; import { route } from '../actions/app-actions'; import { storageGet, storageSet } from './storage-utils'; @@ -89,21 +88,6 @@ export function updateRoute(getState) { } } -// Temporarily detect old topology options to avoid breaking things between releases -// Related to https://github.com/weaveworks/scope/pull/2404 -function detectOldOptions(topologyOptions) { - let bad = false; - each(topologyOptions, (topology) => { - each(topology, (option) => { - if (typeof option === 'string') { - bad = true; - } - }); - }); - return bad; -} - - export function getRouter(dispatch, initialState) { // strip any trailing '/'s. page.base(window.location.pathname.replace(/\/$/, '')); @@ -113,15 +97,10 @@ export function getRouter(dispatch, initialState) { const storageState = storageGet(STORAGE_STATE_KEY); if (storageState) { const parsedState = JSON.parse(decodeURL(storageState)); - const dirtyOptions = detectOldOptions(parsedState.topologyOptions); - if (dirtyOptions) { - dispatch(route(initialState)); - } else { - const mergedState = Object.assign(initialState, parsedState); + const mergedState = Object.assign(initialState, parsedState); // push storage state to URL - window.location.hash = `!/state/${JSON.stringify(mergedState)}`; - dispatch(route(mergedState)); - } + window.location.hash = `!/state/${JSON.stringify(mergedState)}`; + dispatch(route(mergedState)); } else { dispatch(route(initialState)); } @@ -129,12 +108,7 @@ 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)); - } + dispatch(route(state)); }); return page;