mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 16:15:42 -06:00
Dashboard: Fix version restore (#72866)
* Dashboard: Fix version restore * Update comment
This commit is contained in:
parent
b0ed67a306
commit
dd21584961
@ -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);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user