Merge pull request #1893 from weaveworks/1880-fixes-ui-hang-on-absent-topo

Fixes UI hanging if currentTopology no longer exists for some reason
This commit is contained in:
David
2016-09-27 11:35:44 -07:00
committed by GitHub

View File

@@ -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')}`);
}