From 864a126d636f0014249923e2c96f44d1c8bab22a Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Thu, 19 Dec 2024 08:21:48 +0100 Subject: [PATCH] [ES|QL] Clear the cached queries correctly --- .../private/kbn-esql-editor/src/history_local_storage.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platform/packages/private/kbn-esql-editor/src/history_local_storage.ts b/src/platform/packages/private/kbn-esql-editor/src/history_local_storage.ts index 46dd770d8d897..dea49dad80761 100644 --- a/src/platform/packages/private/kbn-esql-editor/src/history_local_storage.ts +++ b/src/platform/packages/private/kbn-esql-editor/src/history_local_storage.ts @@ -87,11 +87,11 @@ export const addQueriesToCache = ( // queries to store in the localstorage allQueries = sortedByDate.slice(0, maxQueriesAllowed); - // clear and reset the queries in the cache - cachedQueries.clear(); allQueries.forEach((queryItem) => { cachedQueries.set(queryItem.queryString, queryItem); }); } + // clear and reset the queries in the cache + cachedQueries.clear(); localStorage.setItem(QUERY_HISTORY_ITEM_KEY, JSON.stringify(allQueries)); };