Handle undefined topology options

This commit is contained in:
jpellizzari
2017-06-05 12:04:25 -07:00
parent 87a2655e67
commit 8c86df8a3e

View File

@@ -37,9 +37,9 @@ class TopologyOptions extends React.Component {
// Multi-select topology options (such as k8s namespaces) are handled here.
// Users can select one, many, or none of these options.
// The component builds an array of the next selected values that are sent to the action.
const opts = activeOptions.toJS();
const opts = activeOptions;
const selected = selectedOption.get('id');
const selectedActiveOptions = opts[selected] || [];
const selectedActiveOptions = opts ? opts.get(selected) : [];
const isSelectedAlready = includes(selectedActiveOptions, value);
if (isSelectedAlready) {
@@ -47,7 +47,7 @@ class TopologyOptions extends React.Component {
nextOptions = selectedActiveOptions.filter(o => o !== value);
} else {
// Add it to the array if it's not selected
nextOptions = selectedActiveOptions.concat(value);
nextOptions = [].concat(selectedActiveOptions, value);
}
// Since the user is clicking an option, remove the highlighting from the 'none' option,
// unless they are removing the last option. In that case, default to the 'none' label.