Commit 459a93da by Torkel Ödegaard Committed by GitHub

Merge pull request #15100 from grafana/annotation-dashboard-switch-fix

Fix for annotations not clearing when switching dashboards 
parents c1d778c7 c3c8cd3f
......@@ -21,12 +21,16 @@ export class AnnotationsSrv {
constructor(private $rootScope, private $q, private datasourceSrv, private backendSrv, private timeSrv) {}
init(dashboard: DashboardModel) {
// always clearPromiseCaches when loading new dashboard
this.clearPromiseCaches();
// clear promises on refresh events
dashboard.on('refresh', () => {
this.globalAnnotationsPromise = null;
this.alertStatesPromise = null;
this.datasourcePromises = null;
});
dashboard.on('refresh', this.clearPromiseCaches.bind(this));
}
clearPromiseCaches() {
this.globalAnnotationsPromise = null;
this.alertStatesPromise = null;
this.datasourcePromises = null;
}
getAnnotations(options) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment