From b2837c21e8b5534fa16a09e3736d83b7288c65b0 Mon Sep 17 00:00:00 2001 From: Simon Howe Date: Mon, 26 Sep 2016 11:56:06 +0200 Subject: [PATCH] Fixes UI hanging if currentTopology no longer exists for some reason - Reasons: k8s was currentTopology but was then disabled while the UI was looking at that view. Fallback to our default-topo-selection logic. --- client/app/scripts/reducers/root.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/app/scripts/reducers/root.js b/client/app/scripts/reducers/root.js index 8bbc9ca67..13f60fb4b 100644 --- a/client/app/scripts/reducers/root.js +++ b/client/app/scripts/reducers/root.js @@ -606,7 +606,8 @@ export function rootReducer(state = initialState, action) { state = state.set('errorUrl', null); state = state.update('topologyUrlsById', topologyUrlsById => topologyUrlsById.clear()); state = processTopologies(state, action.topologies); - if (!state.get('currentTopologyId')) { + const currentTopologyId = state.get('currentTopologyId'); + if (!currentTopologyId || !findTopologyById(state.get('topologies'), currentTopologyId)) { state = state.set('currentTopologyId', getDefaultTopology(state.get('topologies'))); log(`Set currentTopologyId to ${state.get('currentTopologyId')}`); }