Dashboard: Fix version restore (#72866)

* Dashboard: Fix version restore

* Update comment
This commit is contained in:
Alex Khomenko 2023-08-18 15:17:45 +03:00 committed by GitHub
parent b0ed67a306
commit dd21584961
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -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]);

View File

@ -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);
};