DashboardScene: Fixes issue saving new dashboard from panel edit (#86477)

This commit is contained in:
Torkel Ödegaard 2024-04-18 08:46:24 +02:00 committed by GitHub
parent 3870ecd2e0
commit 1327bdf575
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 0 deletions

View File

@ -102,6 +102,27 @@ describe('DashboardScene', () => {
});
});
describe('Given new dashboard in edit mode', () => {
it('when saving it should clear isNew state', () => {
const scene = buildTestScene({
meta: { isNew: true },
});
scene.activate();
scene.onEnterEditMode();
scene.saveCompleted({} as Dashboard, {
id: 1,
slug: 'slug',
uid: 'dash-1',
url: 'sss',
version: 2,
status: 'aaa',
});
expect(scene.state.meta.isNew).toBeFalsy();
});
});
describe('Given scene in edit mode', () => {
let scene: DashboardScene;
let deactivateScene: () => void;

View File

@ -252,6 +252,7 @@ export class DashboardScene extends SceneObjectBase<DashboardSceneState> {
url: result.url,
slug: result.slug,
folderUid: folderUid,
isNew: false,
},
});