From 80fd4e774bb51f3aec476f6da5ae2a8f65bb8340 Mon Sep 17 00:00:00 2001 From: Jakub Szymczak Date: Wed, 23 Oct 2024 10:50:28 +0200 Subject: [PATCH 1/3] add recentSearchHash --- src/components/Search/types.ts | 2 ++ src/libs/SearchQueryUtils.ts | 17 +++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/Search/types.ts b/src/components/Search/types.ts index 4f96090be9d0..43ebbed24943 100644 --- a/src/components/Search/types.ts +++ b/src/components/Search/types.ts @@ -76,6 +76,8 @@ type SearchQueryAST = { type SearchQueryJSON = { inputQuery: SearchQueryString; hash: number; + /** Hash used for putting queries in recent searches list. It ignores sortOrder and sortBy, because we want to treat queries differing only in sort params as the same query */ + recentSearchHash: number; flatFilters: QueryFilters; } & SearchQueryAST; diff --git a/src/libs/SearchQueryUtils.ts b/src/libs/SearchQueryUtils.ts index 32c2eff72007..7c7395ef1a9b 100644 --- a/src/libs/SearchQueryUtils.ts +++ b/src/libs/SearchQueryUtils.ts @@ -208,15 +208,13 @@ function findIDFromDisplayValue(filterName: ValueOf Date: Mon, 28 Oct 2024 09:34:32 +0100 Subject: [PATCH 2/3] don't include policyID in recent hash --- src/libs/SearchQueryUtils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/SearchQueryUtils.ts b/src/libs/SearchQueryUtils.ts index 7c7395ef1a9b..437e7dc26fad 100644 --- a/src/libs/SearchQueryUtils.ts +++ b/src/libs/SearchQueryUtils.ts @@ -210,9 +210,6 @@ function findIDFromDisplayValue(filterName: ValueOf Date: Tue, 5 Nov 2024 10:37:13 +0100 Subject: [PATCH 3/3] fix PR comments --- src/libs/SearchQueryUtils.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libs/SearchQueryUtils.ts b/src/libs/SearchQueryUtils.ts index cdea8923b488..d7a1bee2771f 100644 --- a/src/libs/SearchQueryUtils.ts +++ b/src/libs/SearchQueryUtils.ts @@ -220,8 +220,6 @@ function getQueryHashes(query: SearchQueryJSON): {primaryHash: number; recentSea let orderedQuery = ''; orderedQuery += `${CONST.SEARCH.SYNTAX_ROOT_KEYS.TYPE}:${query.type}`; orderedQuery += ` ${CONST.SEARCH.SYNTAX_ROOT_KEYS.STATUS}:${query.status}`; - orderedQuery += ` ${CONST.SEARCH.SYNTAX_ROOT_KEYS.SORT_BY}:${query.sortBy}`; - orderedQuery += ` ${CONST.SEARCH.SYNTAX_ROOT_KEYS.SORT_ORDER}:${query.sortOrder}`; query.flatFilters.forEach((filter) => { filter.filters.sort((a, b) => localeCompare(a.value.toString(), b.value.toString()));