From 90e0f8cab6c27b535320fd17a55c55e6476ef9dc Mon Sep 17 00:00:00 2001 From: Victor Marin <36818606+mdvictor@users.noreply.github.com> Date: Wed, 13 Mar 2024 18:24:26 +0200 Subject: [PATCH] Allows re-entering edit mode after version restore (#84298) * Allows re-entering edit mode after version restore * refactor * revert to previous commit --- .../features/dashboard-scene/scene/DashboardScene.test.tsx | 1 - public/app/features/dashboard-scene/scene/DashboardScene.tsx | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/public/app/features/dashboard-scene/scene/DashboardScene.test.tsx b/public/app/features/dashboard-scene/scene/DashboardScene.test.tsx index 094b94573e0..f08e544e1a4 100644 --- a/public/app/features/dashboard-scene/scene/DashboardScene.test.tsx +++ b/public/app/features/dashboard-scene/scene/DashboardScene.test.tsx @@ -829,7 +829,6 @@ describe('DashboardScene', () => { expect(res).toBe(true); expect(scene.state.version).toBe(newVersion); - expect(scene.state.title).toBe('new name'); expect(scene.state.isEditing).toBe(false); }); }); diff --git a/public/app/features/dashboard-scene/scene/DashboardScene.tsx b/public/app/features/dashboard-scene/scene/DashboardScene.tsx index c5cdc3f1db7..8c9d84bf950 100644 --- a/public/app/features/dashboard-scene/scene/DashboardScene.tsx +++ b/public/app/features/dashboard-scene/scene/DashboardScene.tsx @@ -327,8 +327,8 @@ export class DashboardScene extends SceneObjectBase { const newState = sceneUtils.cloneSceneObjectState(dashScene.state); newState.version = versionRsp.version; - this._initialState = newState; - this.exitEditMode({ skipConfirm: false, restoreIntialState: true }); + this.setState(newState); + this.exitEditMode({ skipConfirm: true, restoreIntialState: false }); return true; };