From eab5d2b30ef443870167a7ec34ba3d2b603a8aef Mon Sep 17 00:00:00 2001 From: Bogdan Matei Date: Fri, 12 Dec 2025 17:17:34 +0200 Subject: [PATCH] Dashboard: Fix rogue modal when exiting edit mode (#115240) * Dashboard: Fix rogue modal when exiting edit mode * Remove unnecessary change --- .../dashboard-scene/saving/DashboardSceneChangeTracker.ts | 4 ++++ public/app/features/dashboard-scene/scene/DashboardScene.tsx | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/public/app/features/dashboard-scene/saving/DashboardSceneChangeTracker.ts b/public/app/features/dashboard-scene/saving/DashboardSceneChangeTracker.ts index 6bae04e7248..3884106df39 100644 --- a/public/app/features/dashboard-scene/saving/DashboardSceneChangeTracker.ts +++ b/public/app/features/dashboard-scene/saving/DashboardSceneChangeTracker.ts @@ -206,6 +206,10 @@ export class DashboardSceneChangeTracker { } this._changesWorker!.onmessage = (e: MessageEvent) => { + if (!this._dashboard.state.isEditing) { + return; + } + this.updateIsDirty(!!e.data.hasChanges); }; diff --git a/public/app/features/dashboard-scene/scene/DashboardScene.tsx b/public/app/features/dashboard-scene/scene/DashboardScene.tsx index 2312fdec7ed..4e3fa954a51 100644 --- a/public/app/features/dashboard-scene/scene/DashboardScene.tsx +++ b/public/app/features/dashboard-scene/scene/DashboardScene.tsx @@ -271,7 +271,7 @@ export class DashboardScene extends SceneObjectBase impleme public onEnterEditMode = () => { // Save this state - this._initialState = sceneUtils.cloneSceneObjectState(this.state); + this._initialState = sceneUtils.cloneSceneObjectState(this.state, { isDirty: false }); this._initialUrlState = locationService.getLocation(); // Switch to edit mode