Dashboard: Fix for overwriting an edited dashboard in the old architecture (#100288)

Dashboard: Fix for overwriting an edited dashboard in the old architecture (#100247)

(cherry picked from commit 158c5443b5)
This commit is contained in:
Bogdan Matei
2025-02-07 17:46:19 +02:00
committed by GitHub
parent 1f17f33ddc
commit e85d79b034
@@ -1,3 +1,4 @@
import { cloneDeep } from 'lodash';
import { useAsyncFn } from 'react-use';
import { locationUtil } from '@grafana/data';
@@ -45,6 +46,8 @@ export const useDashboardSave = (isCopy = false) => {
const result = await saveDashboard(clone, options, dashboard, saveDashboardRtkQuery);
dashboard.version = result.version;
// Altering the clone leads to an error due to the clone being immutable
clone = cloneDeep(clone);
clone.version = result.version;
dashboard.clearUnsavedChanges(clone, options);