mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboard: Fix version restore (#72866)
* Dashboard: Fix version restore * Update comment
This commit is contained in:
@@ -13,7 +13,7 @@ export const RevertDashboardModal = ({ hideModal, version }: RevertDashboardModa
|
|||||||
const { state, onRestoreDashboard } = useDashboardRestore(version);
|
const { state, onRestoreDashboard } = useDashboardRestore(version);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (state.loading === false && state.value) {
|
if (!state.loading && state.value) {
|
||||||
hideModal();
|
hideModal();
|
||||||
}
|
}
|
||||||
}, [state, hideModal]);
|
}, [state, hideModal]);
|
||||||
|
|||||||
@@ -6,11 +6,14 @@ import { locationService } from '@grafana/runtime';
|
|||||||
import { useAppNotification } from 'app/core/copy/appNotification';
|
import { useAppNotification } from 'app/core/copy/appNotification';
|
||||||
import { useSelector } from 'app/types';
|
import { useSelector } from 'app/types';
|
||||||
|
|
||||||
|
import { dashboardWatcher } from '../../../live/dashboard/dashboardWatcher';
|
||||||
import { DashboardModel } from '../../state';
|
import { DashboardModel } from '../../state';
|
||||||
|
|
||||||
import { historySrv } from './HistorySrv';
|
import { historySrv } from './HistorySrv';
|
||||||
|
|
||||||
const restoreDashboard = async (version: number, dashboard: DashboardModel) => {
|
const restoreDashboard = async (version: number, dashboard: DashboardModel) => {
|
||||||
|
// Skip the watcher logic for this save since it's handled by the hook
|
||||||
|
dashboardWatcher.ignoreNextSave();
|
||||||
return await historySrv.restoreDashboard(dashboard, version);
|
return await historySrv.restoreDashboard(dashboard, version);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user