浏览代码

hopefully proper cluster retrieval

Sean Rhee 5 年之前
父节点
当前提交
9fd809b57e
共有 1 个文件被更改,包括 2 次插入5 次删除
  1. 2 5
      dashboard/src/main/home/sidebar/ClusterSection.tsx

+ 2 - 5
dashboard/src/main/home/sidebar/ClusterSection.tsx

@@ -56,11 +56,8 @@ export default class ClusterSection extends Component<PropsType, StateType> {
           clusters.sort((a: any, b: any) => a.id - b.id);
           clusters.sort((a: any, b: any) => a.id - b.id);
           if (clusters.length > 0) {
           if (clusters.length > 0) {
             this.setState({ clusters });
             this.setState({ clusters });
-            try {
-              setCurrentCluster((localStorage.getItem('currentCluster')) ? 
-                JSON.parse(localStorage.getItem('currentCluster')) : clusters[0]
-              );
-            } catch(err) {
+            setCurrentCluster(JSON.parse(localStorage.getItem('currentCluster')));
+            if (localStorage.getItem('currentCluster') === 'null') {
               setCurrentCluster(clusters[0]);
               setCurrentCluster(clusters[0]);
             }
             }
           } else if (this.props.currentView !== 'provisioner') {
           } else if (this.props.currentView !== 'provisioner') {