Restore dashboards: Fix restore timing issue (#112638)

* Restore dashboards: Fix restore timing issue

* Cleanup
This commit is contained in:
Alex Khomenko
2025-10-21 13:15:13 +03:00
committed by GitHub
parent 5e8294c9d3
commit 268f3ed0fb
2 changed files with 7 additions and 13 deletions
@@ -97,13 +97,6 @@ export function RecentlyDeletedActions() {
return origins;
}, [selectedDashboards, searchState.result]);
const onActionComplete = () => {
dispatch(setAllSelection({ isSelected: false, folderUID: undefined }));
deletedDashboardsCache.clear();
stateManager.doSearchWithDebounce();
};
const getErrorMessage = (error: unknown) => {
if (error instanceof Error) {
return error.message;
@@ -168,9 +161,6 @@ export function RecentlyDeletedActions() {
}
});
// Show consolidated notification
showRestoreNotifications(successful, failed);
const parentUIDs = new Set<string | undefined>();
for (const uid of selectedDashboards) {
const foundItem = resultsView.find((v) => v.uid === uid);
@@ -183,8 +173,12 @@ export function RecentlyDeletedActions() {
parentUIDs.add(folderUID);
}
dispatch(clearFolders(Array.from(parentUIDs)));
dispatch(setAllSelection({ isSelected: false, folderUID: undefined }));
onActionComplete();
deletedDashboardsCache.clear();
await stateManager.doSearch();
showRestoreNotifications(successful, failed);
setIsBulkRestoreLoading(false);
setIsRestoreModalOpen(false);
};
@@ -248,7 +248,7 @@ export class SearchStateManager extends StateManagerBase<SearchState> {
return q;
}
private doSearch() {
doSearch() {
const trackingInfo = {
layout: this.state.layout,
starred: this.state.starred,
@@ -270,7 +270,7 @@ export class SearchStateManager extends StateManagerBase<SearchState> {
const searchTimestamp = Date.now();
const searchPromise = this.state.starred ? searcher.starred(this.lastQuery) : searcher.search(this.lastQuery);
searchPromise
return searchPromise
.then((result) => {
// Only keep the results if it's was issued after the most recently resolved search.
// This prevents results showing out of order if first request is slower than later ones