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

This commit is contained in:
Bogdan Matei 2025-02-07 16:44:55 +02:00 committed by GitHub
parent 53030e7960
commit 158c5443b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,3 +1,4 @@
import { cloneDeep } from 'lodash';
import { useAsyncFn } from 'react-use';
import { locationUtil } from '@grafana/data';
@ -46,6 +47,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);