From 173f09ce0cbf56560a3665f84a4f1e75b0be4258 Mon Sep 17 00:00:00 2001 From: Victor Marin <36818606+mdvictor@users.noreply.github.com> Date: Tue, 19 Aug 2025 10:27:57 +0300 Subject: [PATCH] [release-12.1.2] Dashboard: Resume tracking changes after save from JSON model page (#109796) Dashboard: Resume tracking changes after save from JSON model page (#109607) (cherry picked from commit e285cc2ddcd690b931983c6aa2ac57dd1ada1f5b) Co-authored-by: Bogdan Matei --- .../dashboard-scene/settings/JsonModelEditView.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/app/features/dashboard-scene/settings/JsonModelEditView.tsx b/public/app/features/dashboard-scene/settings/JsonModelEditView.tsx index c6b40b81ff0..53ce75d3e30 100644 --- a/public/app/features/dashboard-scene/settings/JsonModelEditView.tsx +++ b/public/app/features/dashboard-scene/settings/JsonModelEditView.tsx @@ -73,7 +73,7 @@ export class JsonModelEditView extends SceneObjectBase i // FIXME: We could avoid this call by storing the entire dashboard DTO as initial dashboard scene instead of only the spec and metadata const dto = await getDashboardAPI('v2').getDashboardDTO(result.uid); newDashboardScene = transformSaveModelSchemaV2ToScene(dto); - const newState = sceneUtils.cloneSceneObjectState(newDashboardScene.state); + const newState = sceneUtils.cloneSceneObjectState(newDashboardScene.state, { key: dashboard.state.key }); dashboard.pauseTrackingChanges(); dashboard.setInitialSaveModel(dto.spec, dto.metadata); @@ -84,7 +84,7 @@ export class JsonModelEditView extends SceneObjectBase i dashboard: jsonModel, meta: dashboard.state.meta, }); - const newState = sceneUtils.cloneSceneObjectState(newDashboardScene.state); + const newState = sceneUtils.cloneSceneObjectState(newDashboardScene.state, { key: dashboard.state.key }); dashboard.pauseTrackingChanges(); dashboard.setInitialSaveModel(jsonModel, dashboard.state.meta); @@ -92,6 +92,9 @@ export class JsonModelEditView extends SceneObjectBase i } this.setState({ jsonText: this.getJsonText() }); + + // We also need to resume tracking changes since the change handler won't see any later edit + dashboard.resumeTrackingChanges(); }; static Component = ({ model }: SceneComponentProps) => {