From 927b6e33c02b0be71edff613eced282ce59798e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Jamr=C3=B3z?= Date: Thu, 2 Jun 2022 15:48:24 +0200 Subject: [PATCH] Update total items when query history item is deleted to avoid triggering pagination (#49899) --- public/app/features/explore/state/history.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/app/features/explore/state/history.ts b/public/app/features/explore/state/history.ts index e0fe9e9ee19..84447f65b41 100644 --- a/public/app/features/explore/state/history.ts +++ b/public/app/features/explore/state/history.ts @@ -60,9 +60,10 @@ const updateRichHistoryState = ({ updatedQuery, deletedId }: SyncHistoryUpdatesO .map((query) => (query.id === updatedQuery?.id ? updatedQuery : query)) // or remove .filter((query) => query.id !== deletedId); + const deletedItems = item.richHistory.length - newRichHistory.length; dispatch( richHistoryUpdatedAction({ - richHistoryResults: { richHistory: newRichHistory, total: item.richHistoryTotal }, + richHistoryResults: { richHistory: newRichHistory, total: item.richHistoryTotal! - deletedItems }, exploreId, }) );