Dashboard: Resume tracking changes after save from JSON model page (#109607)

This commit is contained in:
Bogdan Matei 2025-08-14 17:25:50 +03:00 committed by GitHub
parent af68304af0
commit e285cc2ddc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -73,7 +73,7 @@ export class JsonModelEditView extends SceneObjectBase<JsonModelEditViewState> 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<JsonModelEditViewState> 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<JsonModelEditViewState> 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<JsonModelEditView>) => {