diff --git a/public/app/features/dashboard/components/VersionHistory/RevertDashboardModal.tsx b/public/app/features/dashboard/components/VersionHistory/RevertDashboardModal.tsx index b33c9fa5a16..e24c2155693 100644 --- a/public/app/features/dashboard/components/VersionHistory/RevertDashboardModal.tsx +++ b/public/app/features/dashboard/components/VersionHistory/RevertDashboardModal.tsx @@ -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]); diff --git a/public/app/features/dashboard/components/VersionHistory/useDashboardRestore.tsx b/public/app/features/dashboard/components/VersionHistory/useDashboardRestore.tsx index fb9e3a70f34..b5f22045ad5 100644 --- a/public/app/features/dashboard/components/VersionHistory/useDashboardRestore.tsx +++ b/public/app/features/dashboard/components/VersionHistory/useDashboardRestore.tsx @@ -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); };