Selaa lähdekoodia

HUE-8594 [editor] Avoid js error when lastSelectedCompute does not exist

Romain Rigaux 7 vuotta sitten
vanhempi
commit
1dcdefb48e

+ 2 - 2
desktop/core/src/desktop/templates/ko_components/ko_context_selector.mako

@@ -138,7 +138,7 @@ from desktop.views import _ko
               // If we can't find exact match we pick first based on type
               if (!found) {
                 clusters.some(function (cluster) {
-                  if (cluster.type === lastSelectedCluster.type) {
+                  if (lastSelectedCluster && cluster.type === lastSelectedCluster.type) {
                     self.cluster(cluster);
                     return true;
                   }
@@ -192,7 +192,7 @@ from desktop.views import _ko
 
                 // If we can't find exact match we pick first based on type
                 if (!computes.some(function (compute) {
-                  if (compute.type === lastSelectedCompute.type) {
+                  if (lastSelectedCluster && compute.type === lastSelectedCompute.type) {
                     self.compute(compute);
                     return true;
                   }