[v10.1.x] Dashboard: Fix version restore (#73482)

Dashboard: Fix version restore (#72866)

* Dashboard: Fix version restore

* Update comment

(cherry picked from commit dd21584961)

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
This commit is contained in:
grafana-delivery-bot[bot]
2023-08-18 15:34:42 +03:00
committed by GitHub
co-authored by Alex Khomenko
parent 7e6432e64a
commit e9d5e4460e
2 changed files with 4 additions and 1 deletions
@@ -13,7 +13,7 @@ export const RevertDashboardModal = ({ hideModal, version }: RevertDashboardModa
const { state, onRestoreDashboard } = useDashboardRestore(version);
useEffect(() => {
if (state.loading === false && state.value) {
if (!state.loading && state.value) {
hideModal();
}
}, [state, hideModal]);
@@ -6,11 +6,14 @@ import { locationService } from '@grafana/runtime';
import { useAppNotification } from 'app/core/copy/appNotification';
import { useSelector } from 'app/types';
import { dashboardWatcher } from '../../../live/dashboard/dashboardWatcher';
import { DashboardModel } from '../../state';
import { historySrv } from './HistorySrv';
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);
};