From 742abc8129d99fc582be05f7acb4ffc20be36fc1 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Fri, 3 Jun 2022 03:31:41 -0400 Subject: [PATCH] [v9.0.x] Query History: Do not show "load more" button when query history item is deleted (#50097) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 927b6e33c02b0be71edff613eced282ce59798e9) Co-authored-by: Piotr Jamróz --- 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, }) );