From 050d902ed1714cea52db4d73b5b043b702c237be Mon Sep 17 00:00:00 2001 From: Dominik Prokop Date: Thu, 30 Jan 2020 13:47:11 +0100 Subject: [PATCH] AppPageCtrl: Fix digest issue with app page initialisation (#21847) --- .../app/features/plugins/plugin_page_ctrl.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/public/app/features/plugins/plugin_page_ctrl.ts b/public/app/features/plugins/plugin_page_ctrl.ts index 51961d96e96..21049a58302 100644 --- a/public/app/features/plugins/plugin_page_ctrl.ts +++ b/public/app/features/plugins/plugin_page_ctrl.ts @@ -6,6 +6,7 @@ import { PluginMeta } from '@grafana/data'; import { NavModelSrv } from 'app/core/core'; import { GrafanaRootScope } from 'app/routes/GrafanaCtrl'; import { AppEvents } from '@grafana/data'; +import { promiseToDigest } from '../../core/utils/promiseToDigest'; export class AppPageCtrl { page: any; @@ -17,14 +18,16 @@ export class AppPageCtrl { constructor(private $routeParams: any, private $rootScope: GrafanaRootScope, private navModelSrv: NavModelSrv) { this.pluginId = $routeParams.pluginId; - Promise.resolve(getPluginSettings(this.pluginId)) - .then(settings => { - this.initPage(settings); - }) - .catch(err => { - this.$rootScope.appEvent(AppEvents.alertError, ['Unknown Plugin']); - this.navModel = this.navModelSrv.getNotFoundNav(); - }); + promiseToDigest($rootScope)( + Promise.resolve(getPluginSettings(this.pluginId)) + .then(settings => { + this.initPage(settings); + }) + .catch(err => { + this.$rootScope.appEvent(AppEvents.alertError, ['Unknown Plugin']); + this.navModel = this.navModelSrv.getNotFoundNav(); + }) + ); } initPage(app: PluginMeta) {