Browse Source

handle new variables created not yet added

Marcus Efraimsson 7 years ago
parent
commit
1e74d7f20a
1 changed files with 5 additions and 4 deletions
  1. 5 4
      public/app/features/templating/variable_srv.ts

+ 5 - 4
public/app/features/templating/variable_srv.ts

@@ -122,12 +122,13 @@ export class VariableSrv {
     }
 
     const g = this.createGraph();
-    const promises = g
-      .getNode(variable.name)
-      .getOptimizedInputEdges()
-      .map(e => {
+    const node = g.getNode(variable.name);
+    let promises = [];
+    if (node) {
+      promises = node.getOptimizedInputEdges().map(e => {
         return this.updateOptions(this.variables.find(v => v.name === e.inputNode.name));
       });
+    }
 
     return this.$q.all(promises).then(() => {
       if (emitChangeEvents) {