Browse Source

fix(templating): fixed duplicate dashboard refresh when changing template variable, #7654

Torkel Ödegaard 9 năm trước cách đây
mục cha
commit
e73b306e0c
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      public/app/features/dashboard/time_srv.ts

+ 5 - 1
public/app/features/dashboard/time_srv.ts

@@ -96,11 +96,15 @@ class TimeSrv {
         this.initTimeFromUrl();
         this.setTime(this.time, true);
       }
-    } else {
+    } else if (this.timeHasChangedSinceLoad()) {
       this.setTime(this.timeAtLoad, true);
     }
   }
 
+  private timeHasChangedSinceLoad() {
+    return this.timeAtLoad.from !== this.time.from || this.timeAtLoad.to !== this.time.to;
+  }
+
   setAutoRefresh(interval) {
     this.dashboard.refresh = interval;
     if (interval) {