mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 01:31:17 +00:00
Handle undefined
This commit is contained in:
@@ -18,7 +18,10 @@ function runAction(action, args, dispatch, getState) {
|
||||
}
|
||||
|
||||
function openNodeDetails(dispatch, getState, run, next) {
|
||||
const { id, label } = getRandomNode(getState);
|
||||
const { id, label } = getRandomNode(getState) || {};
|
||||
if (!id || !label) {
|
||||
return;
|
||||
}
|
||||
run(clickNode, [id, label]);
|
||||
setTimeout(() => {
|
||||
run(clickCloseDetails, [id]);
|
||||
@@ -28,7 +31,10 @@ function openNodeDetails(dispatch, getState, run, next) {
|
||||
|
||||
function changeTopology(dispatch, getState, run, next) {
|
||||
const blacklist = ['hosts', 'weave', 'containers-by-hostname'];
|
||||
const { topologies } = getState().toJS();
|
||||
const { topologies } = getState().toJS() || {};
|
||||
if (!topologies) {
|
||||
return;
|
||||
}
|
||||
const subTopologies = _.reduce(topologies, (result, t) => {
|
||||
if (t.sub_topologies) {
|
||||
return result.concat(t.sub_topologies);
|
||||
|
||||
Reference in New Issue
Block a user