From 8c86df8a3e0530c802f70a9f9ac7cb0d35a3c6f8 Mon Sep 17 00:00:00 2001 From: jpellizzari Date: Mon, 5 Jun 2017 12:04:25 -0700 Subject: [PATCH] Handle undefined topology options --- client/app/scripts/components/topology-options.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/app/scripts/components/topology-options.js b/client/app/scripts/components/topology-options.js index 448b355ec..f0206108b 100644 --- a/client/app/scripts/components/topology-options.js +++ b/client/app/scripts/components/topology-options.js @@ -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.