diff --git a/client/app/scripts/reducers/root.js b/client/app/scripts/reducers/root.js index 425f16d4d..1eaa204f5 100644 --- a/client/app/scripts/reducers/root.js +++ b/client/app/scripts/reducers/root.js @@ -650,11 +650,15 @@ export function rootReducer(state = initialState, action) { log(`Set currentTopologyId to ${state.get('currentTopologyId')}`); } state = setTopology(state, state.get('currentTopologyId')); - // only set on first load, if options are not already set via route - if (!state.get('topologiesLoaded') && state.get('topologyOptions').size === 0) { - state = state.set('topologyOptions', getDefaultTopologyOptions(state)); + + // Expand topology options with topologies' defaults on first load, but let + // the current state of topologyOptions (which at this point reflects the + // URL state) still take the precedence over defaults. + if (!state.get('topologiesLoaded')) { + const options = getDefaultTopologyOptions(state).mergeDeep(state.get('topologyOptions')); + state = state.set('topologyOptions', options); + state = state.set('topologiesLoaded', true); } - state = state.set('topologiesLoaded', true); return state; } @@ -683,6 +687,9 @@ export function rootReducer(state = initialState, action) { selectedNodeId: action.state.selectedNodeId, pinnedMetricType: action.state.pinnedMetricType, }); + if (action.state.topologyOptions) { + state = state.set('topologyOptions', fromJS(action.state.topologyOptions)); + } if (action.state.topologyViewMode) { state = state.set('topologyViewMode', action.state.topologyViewMode); } @@ -716,12 +723,6 @@ export function rootReducer(state = initialState, action) { } else { state = state.update('nodeDetails', nodeDetails => nodeDetails.clear()); } - // Use the default topology options for all the fields not - // explicitly listed in the Scope state (URL or local storage). - state = state.set( - 'topologyOptions', - getDefaultTopologyOptions(state).mergeDeep(action.state.topologyOptions), - ); return state; }