From da892dcd37a2d32869292c744816d3e4e68c9692 Mon Sep 17 00:00:00 2001
From: TaduJR <nattysec26@gmail.com>
Date: Sun, 23 Nov 2025 10:07:16 +0300
Subject: [PATCH 1/9] feat: Don't inject search syntax into the NewDot search
 field unless the user explicitly enters it

---
 src/ONYXKEYS.ts                               |  4 ++++
 .../Search/SearchAutocompleteInput.tsx        |  3 ++-
 .../SearchPageHeaderInput.tsx                 | 19 ++++++++++++-------
 .../Search/SearchRouter/SearchRouter.tsx      |  2 ++
 src/hooks/useSearchTypeMenu.tsx               |  4 +++-
 src/libs/actions/Search.ts                    |  8 ++++++++
 src/pages/Search/AdvancedSearchFilters.tsx    |  3 ++-
 src/pages/Search/SearchTypeMenu.tsx           |  4 +++-
 src/types/onyx/SearchContext.ts               |  7 +++++++
 src/types/onyx/index.ts                       |  2 ++
 10 files changed, 45 insertions(+), 11 deletions(-)
 create mode 100644 src/types/onyx/SearchContext.ts

diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts
index d818b71e8ac3..11b10cea9bd1 100755
--- a/src/ONYXKEYS.ts
+++ b/src/ONYXKEYS.ts
@@ -517,6 +517,9 @@ const ONYXKEYS = {
     /** Stores the information about the recent searches */
     RECENT_SEARCHES: 'nvp_recentSearches',
 
+    /** Stores the current search page context (e.g., whether to show the search query) */
+    SEARCH_CONTEXT: 'searchContext',
+
     /** Stores recently used currencies */
     RECENTLY_USED_CURRENCIES: 'nvp_recentlyUsedCurrencies',
 
@@ -1104,6 +1107,7 @@ type OnyxValuesMapping = {
     [ONYXKEYS.NVP_TRY_NEW_DOT]: OnyxTypes.TryNewDot;
     [ONYXKEYS.RECENT_SEARCHES]: Record<string, OnyxTypes.RecentSearchItem>;
     [ONYXKEYS.SAVED_SEARCHES]: OnyxTypes.SaveSearch;
+    [ONYXKEYS.SEARCH_CONTEXT]: OnyxTypes.SearchContext;
     [ONYXKEYS.RECENTLY_USED_CURRENCIES]: string[];
     [ONYXKEYS.ACTIVE_CLIENTS]: string[];
     [ONYXKEYS.DEVICE_ID]: string;
diff --git a/src/components/Search/SearchAutocompleteInput.tsx b/src/components/Search/SearchAutocompleteInput.tsx
index e251c1c32706..130205928213 100644
--- a/src/components/Search/SearchAutocompleteInput.tsx
+++ b/src/components/Search/SearchAutocompleteInput.tsx
@@ -16,7 +16,7 @@ import useNetwork from '@hooks/useNetwork';
 import useOnyx from '@hooks/useOnyx';
 import useTheme from '@hooks/useTheme';
 import useThemeStyles from '@hooks/useThemeStyles';
-import {clearAdvancedFilters} from '@libs/actions/Search';
+import {clearAdvancedFilters, setSearchContext} from '@libs/actions/Search';
 import Navigation from '@libs/Navigation/Navigation';
 import scheduleOnLiveMarkdownRuntime from '@libs/scheduleOnLiveMarkdownRuntime';
 import {getAutocompleteCategories, getAutocompleteTags, parseForLiveMarkdown} from '@libs/SearchAutocompleteUtils';
@@ -185,6 +185,7 @@ function SearchAutocompleteInput({
     const clearFilters = useCallback(() => {
         clearAdvancedFilters();
         onSearchQueryChange('');
+        setSearchContext(false);
 
         // Check if we are on the search page before clearing query. If we are using the popup search menu,
         // then the clear button is ONLY available when the search is *not* saved, so we don't have to navigate
diff --git a/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx b/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx
index 9497e85f90da..96abbb5bbe1e 100644
--- a/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx
+++ b/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx
@@ -25,7 +25,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
 import useTheme from '@hooks/useTheme';
 import useThemeStyles from '@hooks/useThemeStyles';
 import {navigateToAndOpenReport} from '@libs/actions/Report';
-import {clearAllFilters} from '@libs/actions/Search';
+import {clearAllFilters, setSearchContext} from '@libs/actions/Search';
 import {mergeCardListWithWorkspaceFeeds} from '@libs/CardUtils';
 import Log from '@libs/Log';
 import Navigation from '@libs/Navigation/Navigation';
@@ -71,10 +71,12 @@ function SearchPageHeaderInput({queryJSON, searchRouterListVisible, hideSearchRo
     const [currentUserAccountID = -1] = useOnyx(ONYXKEYS.SESSION, {selector: accountIDSelector, canBeMissing: false});
     const queryText = buildUserReadableQueryString(queryJSON, personalDetails, reports, taxRates, allCards, allFeeds, policies, currentUserAccountID);
 
-    // The actual input text that the user sees
-    const [textInputValue, setTextInputValue] = useState(isDefaultQuery ? '' : queryText);
+    const [searchContext] = useOnyx(ONYXKEYS.SEARCH_CONTEXT, {canBeMissing: true});
+    const shouldShowQuery = searchContext?.shouldShowSearchQuery ?? false;
+
+    const [textInputValue, setTextInputValue] = useState('');
     // The input text that was last used for autocomplete; needed for the SearchAutocompleteList when browsing list via arrow keys
-    const [autocompleteQueryValue, setAutocompleteQueryValue] = useState(isDefaultQuery ? '' : queryText);
+    const [autocompleteQueryValue, setAutocompleteQueryValue] = useState('');
     const [selection, setSelection] = useState({start: textInputValue.length, end: textInputValue.length});
 
     const [autocompleteSubstitutions, setAutocompleteSubstitutions] = useState<SubstitutionMap>({});
@@ -108,9 +110,11 @@ function SearchPageHeaderInput({queryJSON, searchRouterListVisible, hideSearchRo
     }, [isFocused, registerSearchPageInput, displayNarrowHeader]);
 
     useEffect(() => {
-        setTextInputValue(isDefaultQuery ? '' : queryText);
-        setAutocompleteQueryValue(isDefaultQuery ? '' : queryText);
-    }, [isDefaultQuery, queryText]);
+        const newValue = shouldShowQuery ? queryText : '';
+
+        setTextInputValue(newValue);
+        setAutocompleteQueryValue(newValue);
+    }, [isDefaultQuery, queryText, shouldShowQuery]);
 
     useEffect(() => {
         const substitutionsMap = buildSubstitutionsMap(originalInputQuery, personalDetails, reports, taxRates, allCards, allFeeds, policies, currentUserAccountID);
@@ -205,6 +209,7 @@ function SearchPageHeaderInput({queryJSON, searchRouterListVisible, hideSearchRo
                 return;
             }
 
+            setSearchContext(true);
             Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: updatedQuery}));
             hideSearchRouterList?.();
             setIsAutocompleteListVisible(false);
diff --git a/src/components/Search/SearchRouter/SearchRouter.tsx b/src/components/Search/SearchRouter/SearchRouter.tsx
index ff2d80b0ddbe..7a403b31bfb7 100644
--- a/src/components/Search/SearchRouter/SearchRouter.tsx
+++ b/src/components/Search/SearchRouter/SearchRouter.tsx
@@ -40,6 +40,7 @@ import Navigation from '@navigation/Navigation';
 import type {ReportsSplitNavigatorParamList} from '@navigation/types';
 import variables from '@styles/variables';
 import {navigateToAndOpenReport, searchInServer} from '@userActions/Report';
+import {setSearchContext} from '@userActions/Search';
 import CONST, {CONTINUATION_DETECTION_SEARCH_FILTER_KEYS} from '@src/CONST';
 import ONYXKEYS from '@src/ONYXKEYS';
 import ROUTES from '@src/ROUTES';
@@ -291,6 +292,7 @@ function SearchRouter({onRouterClose, shouldHideInputCaret, isSearchRouterDispla
 
             backHistory(() => {
                 onRouterClose();
+                setSearchContext(true);
                 Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: updatedQuery}));
             });
 
diff --git a/src/hooks/useSearchTypeMenu.tsx b/src/hooks/useSearchTypeMenu.tsx
index fa512574ecfd..5c3625b99717 100644
--- a/src/hooks/useSearchTypeMenu.tsx
+++ b/src/hooks/useSearchTypeMenu.tsx
@@ -5,7 +5,7 @@ import {usePersonalDetails} from '@components/OnyxListItemProvider';
 import type {PopoverMenuItem} from '@components/PopoverMenu';
 import type {SearchQueryJSON} from '@components/Search/types';
 import ThreeDotsMenu from '@components/ThreeDotsMenu';
-import {clearAllFilters} from '@libs/actions/Search';
+import {clearAllFilters, setSearchContext} from '@libs/actions/Search';
 import {mergeCardListWithWorkspaceFeeds} from '@libs/CardUtils';
 import Navigation from '@libs/Navigation/Navigation';
 import {getAllTaxRates} from '@libs/PolicyUtils';
@@ -97,6 +97,7 @@ export default function useSearchTypeMenu(queryJSON: SearchQueryJSON) {
                 ...baseMenuItem,
                 onSelected: () => {
                     clearAllFilters();
+                    setSearchContext(false);
                     Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: item?.query ?? '', name: item?.name}));
                 },
                 rightComponent: (
@@ -170,6 +171,7 @@ export default function useSearchTypeMenu(queryJSON: SearchQueryJSON) {
                             shouldCallAfterModalHide: true,
                             onSelected: singleExecution(() => {
                                 clearAllFilters();
+                                setSearchContext(false);
                                 Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: item.searchQuery}));
                             }),
                         });
diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts
index 99c66ed98754..6e1090f74a7d 100644
--- a/src/libs/actions/Search.ts
+++ b/src/libs/actions/Search.ts
@@ -929,6 +929,13 @@ function clearAllFilters() {
     Onyx.set(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, null);
 }
 
+/**
+ * Sets whether the search query should be displayed in the search input field
+ */
+function setSearchContext(shouldShowSearchQuery: boolean) {
+    Onyx.set(ONYXKEYS.SEARCH_CONTEXT, {shouldShowSearchQuery});
+}
+
 function clearAdvancedFilters() {
     const values: Partial<Nullable<SearchAdvancedFiltersForm>> = {};
     Object.values(FILTER_KEYS)
@@ -1178,6 +1185,7 @@ export {
     updateAdvancedFilters,
     clearAllFilters,
     clearAdvancedFilters,
+    setSearchContext,
     deleteSavedSearch,
     payMoneyRequestOnSearch,
     approveMoneyRequestOnSearch,
diff --git a/src/pages/Search/AdvancedSearchFilters.tsx b/src/pages/Search/AdvancedSearchFilters.tsx
index d82e0be4f3a7..e2a6502ce031 100644
--- a/src/pages/Search/AdvancedSearchFilters.tsx
+++ b/src/pages/Search/AdvancedSearchFilters.tsx
@@ -546,7 +546,8 @@ function AdvancedSearchFilters() {
     const waitForNavigate = useWaitForNavigation();
     const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: false});
     const [savedSearches] = useOnyx(ONYXKEYS.SAVED_SEARCHES, {canBeMissing: true});
-    const [searchAdvancedFilters = getEmptyObject<SearchAdvancedFiltersForm>()] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true});
+    const [searchAdvancedFiltersData] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true});
+    const searchAdvancedFilters = searchAdvancedFiltersData ?? getEmptyObject<SearchAdvancedFiltersForm>();
     const [userCardList] = useOnyx(ONYXKEYS.CARD_LIST, {canBeMissing: false});
     const [workspaceCardFeeds] = useOnyx(ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST, {canBeMissing: false});
     const allCards = useMemo(() => mergeCardListWithWorkspaceFeeds(workspaceCardFeeds ?? CONST.EMPTY_OBJECT, userCardList, true), [userCardList, workspaceCardFeeds]);
diff --git a/src/pages/Search/SearchTypeMenu.tsx b/src/pages/Search/SearchTypeMenu.tsx
index 6129184ca20a..16b04e2d46df 100644
--- a/src/pages/Search/SearchTypeMenu.tsx
+++ b/src/pages/Search/SearchTypeMenu.tsx
@@ -22,7 +22,7 @@ import useOnyx from '@hooks/useOnyx';
 import useSearchTypeMenuSections from '@hooks/useSearchTypeMenuSections';
 import useSingleExecution from '@hooks/useSingleExecution';
 import useThemeStyles from '@hooks/useThemeStyles';
-import {clearAllFilters} from '@libs/actions/Search';
+import {clearAllFilters, setSearchContext} from '@libs/actions/Search';
 import {mergeCardListWithWorkspaceFeeds} from '@libs/CardUtils';
 import Navigation from '@libs/Navigation/Navigation';
 import {getAllTaxRates} from '@libs/PolicyUtils';
@@ -99,6 +99,7 @@ function SearchTypeMenu({queryJSON}: SearchTypeMenuProps) {
                 ...baseMenuItem,
                 onPress: () => {
                     clearAllFilters();
+                    setSearchContext(false);
                     Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: item?.query ?? '', name: item?.name}));
                 },
                 rightComponent: (
@@ -241,6 +242,7 @@ function SearchTypeMenu({queryJSON}: SearchTypeMenuProps) {
                                         const onPress = singleExecution(() => {
                                             clearAllFilters();
                                             clearSelectedTransactions();
+                                            setSearchContext(false);
                                             Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: item.searchQuery}));
                                         });
 
diff --git a/src/types/onyx/SearchContext.ts b/src/types/onyx/SearchContext.ts
new file mode 100644
index 000000000000..5e815cd957a6
--- /dev/null
+++ b/src/types/onyx/SearchContext.ts
@@ -0,0 +1,7 @@
+/** Model of the search context */
+type SearchContext = {
+    /** Whether to show the search query in the input field */
+    shouldShowSearchQuery: boolean;
+};
+
+export default SearchContext;
diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts
index 6cab4c8f6799..b7b6b30b41ec 100644
--- a/src/types/onyx/index.ts
+++ b/src/types/onyx/index.ts
@@ -102,6 +102,7 @@ import type ReviewDuplicates from './ReviewDuplicates';
 import type {SaveSearch} from './SaveSearch';
 import type ScheduleCallDraft from './ScheduleCallDraft';
 import type ScreenShareRequest from './ScreenShareRequest';
+import type SearchContext from './SearchContext';
 import type SearchResults from './SearchResults';
 import type SecurityGroup from './SecurityGroup';
 import type SelectedTabRequest from './SelectedTabRequest';
@@ -262,6 +263,7 @@ export type {
     CardFeeds,
     SaveSearch,
     RecentSearchItem,
+    SearchContext,
     ImportedSpreadsheet,
     ImportedSpreadsheetMemberData,
     Onboarding,

From 1a8794044bbbeabd0b098eb09056d34ed65a5276 Mon Sep 17 00:00:00 2001
From: TaduJR <nattysec26@gmail.com>
Date: Mon, 24 Nov 2025 16:32:11 +0300
Subject: [PATCH 2/9] refactor: remove unrelated refactoring and fix useEffect
 dependencies

---
 .../Search/SearchPageHeader/SearchPageHeaderInput.tsx          | 2 +-
 src/pages/Search/AdvancedSearchFilters.tsx                     | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx b/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx
index 96abbb5bbe1e..d8fb61a3fa29 100644
--- a/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx
+++ b/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx
@@ -114,7 +114,7 @@ function SearchPageHeaderInput({queryJSON, searchRouterListVisible, hideSearchRo
 
         setTextInputValue(newValue);
         setAutocompleteQueryValue(newValue);
-    }, [isDefaultQuery, queryText, shouldShowQuery]);
+    }, [queryText, shouldShowQuery]);
 
     useEffect(() => {
         const substitutionsMap = buildSubstitutionsMap(originalInputQuery, personalDetails, reports, taxRates, allCards, allFeeds, policies, currentUserAccountID);
diff --git a/src/pages/Search/AdvancedSearchFilters.tsx b/src/pages/Search/AdvancedSearchFilters.tsx
index e2a6502ce031..d82e0be4f3a7 100644
--- a/src/pages/Search/AdvancedSearchFilters.tsx
+++ b/src/pages/Search/AdvancedSearchFilters.tsx
@@ -546,8 +546,7 @@ function AdvancedSearchFilters() {
     const waitForNavigate = useWaitForNavigation();
     const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: false});
     const [savedSearches] = useOnyx(ONYXKEYS.SAVED_SEARCHES, {canBeMissing: true});
-    const [searchAdvancedFiltersData] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true});
-    const searchAdvancedFilters = searchAdvancedFiltersData ?? getEmptyObject<SearchAdvancedFiltersForm>();
+    const [searchAdvancedFilters = getEmptyObject<SearchAdvancedFiltersForm>()] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true});
     const [userCardList] = useOnyx(ONYXKEYS.CARD_LIST, {canBeMissing: false});
     const [workspaceCardFeeds] = useOnyx(ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST, {canBeMissing: false});
     const allCards = useMemo(() => mergeCardListWithWorkspaceFeeds(workspaceCardFeeds ?? CONST.EMPTY_OBJECT, userCardList, true), [userCardList, workspaceCardFeeds]);

From ef60ce0cf8ed1a8c3c121df7732c780d10528d95 Mon Sep 17 00:00:00 2001
From: TaduJR <nattysec26@gmail.com>
Date: Mon, 24 Nov 2025 16:41:04 +0300
Subject: [PATCH 3/9] chore: remove unused isDefaultQuery variable and import

---
 .../Search/SearchPageHeader/SearchPageHeaderInput.tsx          | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx b/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx
index d8fb61a3fa29..adb29c3e167a 100644
--- a/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx
+++ b/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx
@@ -32,7 +32,7 @@ import Navigation from '@libs/Navigation/Navigation';
 import {getAllTaxRates} from '@libs/PolicyUtils';
 import type {OptionData} from '@libs/ReportUtils';
 import {getAutocompleteQueryWithComma, getQueryWithoutAutocompletedPart} from '@libs/SearchAutocompleteUtils';
-import {buildUserReadableQueryString, getQueryWithUpdatedValues, isDefaultExpensesQuery, sanitizeSearchValue} from '@libs/SearchQueryUtils';
+import {buildUserReadableQueryString, getQueryWithUpdatedValues, sanitizeSearchValue} from '@libs/SearchQueryUtils';
 import StringUtils from '@libs/StringUtils';
 import variables from '@styles/variables';
 import CONST from '@src/CONST';
@@ -67,7 +67,6 @@ function SearchPageHeaderInput({queryJSON, searchRouterListVisible, hideSearchRo
     const allCards = useMemo(() => mergeCardListWithWorkspaceFeeds(workspaceCardFeeds ?? CONST.EMPTY_OBJECT, userCardList), [userCardList, workspaceCardFeeds]);
     const [allFeeds] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER, {canBeMissing: true});
     const {inputQuery: originalInputQuery} = queryJSON;
-    const isDefaultQuery = isDefaultExpensesQuery(queryJSON);
     const [currentUserAccountID = -1] = useOnyx(ONYXKEYS.SESSION, {selector: accountIDSelector, canBeMissing: false});
     const queryText = buildUserReadableQueryString(queryJSON, personalDetails, reports, taxRates, allCards, allFeeds, policies, currentUserAccountID);
 

From d54e7eab95afa2fe07b1448f15983dc3a0598b01 Mon Sep 17 00:00:00 2001
From: TaduJR <nattysec26@gmail.com>
Date: Mon, 24 Nov 2025 19:34:12 +0300
Subject: [PATCH 4/9] chore: CI restart


From 7ccb044fb84b97c45c30499c3600b1c84ba5b7a5 Mon Sep 17 00:00:00 2001
From: TaduJR <nattysec26@gmail.com>
Date: Fri, 5 Dec 2025 19:33:36 +0300
Subject: [PATCH 5/9] fix: X button should only clear input text, not reset
 search or navigate

---
 .../Search/SearchAutocompleteInput.tsx        | 23 +++----------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/src/components/Search/SearchAutocompleteInput.tsx b/src/components/Search/SearchAutocompleteInput.tsx
index 130205928213..ceef4dac2816 100644
--- a/src/components/Search/SearchAutocompleteInput.tsx
+++ b/src/components/Search/SearchAutocompleteInput.tsx
@@ -16,15 +16,12 @@ import useNetwork from '@hooks/useNetwork';
 import useOnyx from '@hooks/useOnyx';
 import useTheme from '@hooks/useTheme';
 import useThemeStyles from '@hooks/useThemeStyles';
-import {clearAdvancedFilters, setSearchContext} from '@libs/actions/Search';
-import Navigation from '@libs/Navigation/Navigation';
+import {setSearchContext} from '@libs/actions/Search';
 import scheduleOnLiveMarkdownRuntime from '@libs/scheduleOnLiveMarkdownRuntime';
 import {getAutocompleteCategories, getAutocompleteTags, parseForLiveMarkdown} from '@libs/SearchAutocompleteUtils';
-import {buildCannedSearchQuery} from '@libs/SearchQueryUtils';
 import variables from '@styles/variables';
 import CONST from '@src/CONST';
 import ONYXKEYS from '@src/ONYXKEYS';
-import ROUTES from '@src/ROUTES';
 import type {SubstitutionMap} from './SearchRouter/getQueryWithSubstitutions';
 
 type SearchAutocompleteInputProps = {
@@ -182,23 +179,9 @@ function SearchAutocompleteInput({
         [currentUserPersonalDetails.displayName, substitutionMap, currencySharedValue, categorySharedValue, tagSharedValue, emailListSharedValue],
     );
 
-    const clearFilters = useCallback(() => {
-        clearAdvancedFilters();
+    const clearInput = useCallback(() => {
         onSearchQueryChange('');
         setSearchContext(false);
-
-        // Check if we are on the search page before clearing query. If we are using the popup search menu,
-        // then the clear button is ONLY available when the search is *not* saved, so we don't have to navigate
-        const currentRoute = Navigation.getActiveRouteWithoutParams();
-        const isSearchPage = currentRoute === `/${ROUTES.SEARCH_ROOT.route}`;
-
-        if (isSearchPage) {
-            Navigation.navigate(
-                ROUTES.SEARCH_ROOT.getRoute({
-                    query: buildCannedSearchQuery(),
-                }),
-            );
-        }
     }, [onSearchQueryChange]);
 
     const inputWidth = isFullWidth ? styles.w100 : {width: variables.popoverWidth};
@@ -261,7 +244,7 @@ function SearchAutocompleteInput({
                         selection={selection}
                         shouldShowClearButton={!!value && !isSearchingForReports}
                         shouldHideClearButton={false}
-                        onClearInput={clearFilters}
+                        onClearInput={clearInput}
                         forwardedFSClass={CONST.FULLSTORY.CLASS.UNMASK}
                     />
                 </View>

From cbdc3f7d00ed81aa6df6a1be580fb5ec48bdb71b Mon Sep 17 00:00:00 2001
From: TaduJR <nattysec26@gmail.com>
Date: Fri, 19 Dec 2025 09:53:05 +0300
Subject: [PATCH 6/9] fix: export clearAllFilters from Search actions

---
 src/libs/actions/Search.ts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts
index e50d5d1782ff..dfe45ee919f6 100644
--- a/src/libs/actions/Search.ts
+++ b/src/libs/actions/Search.ts
@@ -1224,6 +1224,7 @@ export {
     queueExportSearchWithTemplate,
     updateAdvancedFilters,
     clearAdvancedFilters,
+    clearAllFilters,
     setSearchContext,
     deleteSavedSearch,
     payMoneyRequestOnSearch,

From 1cbd0a46ca1ae47c9eb8ab5f934ab718ff2a080e Mon Sep 17 00:00:00 2001
From: TaduJR <nattysec26@gmail.com>
Date: Fri, 19 Dec 2025 11:08:13 +0300
Subject: [PATCH 7/9] chore: CI restart


From 2a94cc948529998e9a6e0d3c91b869688deac42a Mon Sep 17 00:00:00 2001
From: TaduJR <nattysec26@gmail.com>
Date: Fri, 19 Dec 2025 11:45:58 +0300
Subject: [PATCH 8/9] fix: use clearAdvancedFilters instead of clearAllFilters

---
 src/hooks/useSearchTypeMenu.tsx     | 6 +++---
 src/libs/actions/Search.ts          | 8 --------
 src/pages/Search/SearchTypeMenu.tsx | 4 ++--
 3 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/src/hooks/useSearchTypeMenu.tsx b/src/hooks/useSearchTypeMenu.tsx
index 5efc56532a13..65a6799015ca 100644
--- a/src/hooks/useSearchTypeMenu.tsx
+++ b/src/hooks/useSearchTypeMenu.tsx
@@ -6,7 +6,7 @@ import type {PopoverMenuItem} from '@components/PopoverMenu';
 import {useSearchContext} from '@components/Search/SearchContext';
 import type {SearchQueryJSON} from '@components/Search/types';
 import ThreeDotsMenu from '@components/ThreeDotsMenu';
-import {clearAllFilters, setSearchContext} from '@libs/actions/Search';
+import {clearAdvancedFilters, setSearchContext} from '@libs/actions/Search';
 import {mergeCardListWithWorkspaceFeeds} from '@libs/CardUtils';
 import Navigation from '@libs/Navigation/Navigation';
 import {getAllTaxRates} from '@libs/PolicyUtils';
@@ -109,7 +109,7 @@ export default function useSearchTypeMenu(queryJSON: SearchQueryJSON) {
             return {
                 ...baseMenuItem,
                 onSelected: () => {
-                    clearAllFilters();
+                    clearAdvancedFilters();
                     setSearchContext(false);
                     Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: item?.query ?? '', name: item?.name}));
                 },
@@ -182,7 +182,7 @@ export default function useSearchTypeMenu(queryJSON: SearchQueryJSON) {
                             containerStyle: isSelected ? [{backgroundColor: theme.border}] : undefined,
                             shouldCallAfterModalHide: true,
                             onSelected: singleExecution(() => {
-                                clearAllFilters();
+                                clearAdvancedFilters();
                                 setSearchContext(false);
                                 Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: item.searchQuery}));
                             }),
diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts
index dfe45ee919f6..9af37f4078e4 100644
--- a/src/libs/actions/Search.ts
+++ b/src/libs/actions/Search.ts
@@ -958,13 +958,6 @@ function updateAdvancedFilters(values: Nullable<Partial<FormOnyxValues<typeof ON
     Onyx.merge(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, values);
 }
 
-/**
- * Clears all values for the advanced filters search form.
- */
-function clearAllFilters() {
-    Onyx.set(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, null);
-}
-
 /**
  * Sets whether the search query should be displayed in the search input field
  */
@@ -1224,7 +1217,6 @@ export {
     queueExportSearchWithTemplate,
     updateAdvancedFilters,
     clearAdvancedFilters,
-    clearAllFilters,
     setSearchContext,
     deleteSavedSearch,
     payMoneyRequestOnSearch,
diff --git a/src/pages/Search/SearchTypeMenu.tsx b/src/pages/Search/SearchTypeMenu.tsx
index b82c8c14caf6..15c48fe41fac 100644
--- a/src/pages/Search/SearchTypeMenu.tsx
+++ b/src/pages/Search/SearchTypeMenu.tsx
@@ -22,7 +22,7 @@ import useSearchTypeMenuSections from '@hooks/useSearchTypeMenuSections';
 import useSingleExecution from '@hooks/useSingleExecution';
 import useSuggestedSearchDefaultNavigation from '@hooks/useSuggestedSearchDefaultNavigation';
 import useThemeStyles from '@hooks/useThemeStyles';
-import {clearAllFilters, setSearchContext} from '@libs/actions/Search';
+import {clearAdvancedFilters, setSearchContext} from '@libs/actions/Search';
 import {mergeCardListWithWorkspaceFeeds} from '@libs/CardUtils';
 import Navigation from '@libs/Navigation/Navigation';
 import {getAllTaxRates} from '@libs/PolicyUtils';
@@ -100,7 +100,7 @@ function SearchTypeMenu({queryJSON}: SearchTypeMenuProps) {
             return {
                 ...baseMenuItem,
                 onPress: () => {
-                    clearAllFilters();
+                    clearAdvancedFilters();
                     setSearchContext(false);
                     Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: item?.query ?? '', name: item?.name}));
                 },

From 28e9b25d7e04382a38a76c07a30000af297e6f27 Mon Sep 17 00:00:00 2001
From: TaduJR <nattysec26@gmail.com>
Date: Mon, 22 Dec 2025 20:52:47 +0300
Subject: [PATCH 9/9] fix: Remove redundant clearAdvancedFilters calls to
 prevent race conditions

---
 src/hooks/useSearchTypeMenu.tsx     | 4 +---
 src/pages/Search/SearchTypeMenu.tsx | 3 +--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/hooks/useSearchTypeMenu.tsx b/src/hooks/useSearchTypeMenu.tsx
index ae777cd251b6..c0d603e0b76e 100644
--- a/src/hooks/useSearchTypeMenu.tsx
+++ b/src/hooks/useSearchTypeMenu.tsx
@@ -6,7 +6,7 @@ import type {PopoverMenuItem} from '@components/PopoverMenu';
 import {useSearchContext} from '@components/Search/SearchContext';
 import type {SearchQueryJSON} from '@components/Search/types';
 import ThreeDotsMenu from '@components/ThreeDotsMenu';
-import {clearAdvancedFilters, setSearchContext} from '@libs/actions/Search';
+import {setSearchContext} from '@libs/actions/Search';
 import {mergeCardListWithWorkspaceFeeds} from '@libs/CardUtils';
 import Navigation from '@libs/Navigation/Navigation';
 import {getAllTaxRates} from '@libs/PolicyUtils';
@@ -120,7 +120,6 @@ export default function useSearchTypeMenu(queryJSON: SearchQueryJSON) {
             return {
                 ...baseMenuItem,
                 onSelected: () => {
-                    clearAdvancedFilters();
                     setSearchContext(false);
                     Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: item?.query ?? '', name: item?.name}));
                 },
@@ -194,7 +193,6 @@ export default function useSearchTypeMenu(queryJSON: SearchQueryJSON) {
                             containerStyle: isSelected ? [{backgroundColor: theme.border}] : undefined,
                             shouldCallAfterModalHide: true,
                             onSelected: singleExecution(() => {
-                                clearAdvancedFilters();
                                 setSearchContext(false);
                                 Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: item.searchQuery}));
                             }),
diff --git a/src/pages/Search/SearchTypeMenu.tsx b/src/pages/Search/SearchTypeMenu.tsx
index fc0dfc3743c6..d37e7dfe010d 100644
--- a/src/pages/Search/SearchTypeMenu.tsx
+++ b/src/pages/Search/SearchTypeMenu.tsx
@@ -22,7 +22,7 @@ import useSearchTypeMenuSections from '@hooks/useSearchTypeMenuSections';
 import useSingleExecution from '@hooks/useSingleExecution';
 import useSuggestedSearchDefaultNavigation from '@hooks/useSuggestedSearchDefaultNavigation';
 import useThemeStyles from '@hooks/useThemeStyles';
-import {clearAdvancedFilters, setSearchContext} from '@libs/actions/Search';
+import {setSearchContext} from '@libs/actions/Search';
 import {mergeCardListWithWorkspaceFeeds} from '@libs/CardUtils';
 import Navigation from '@libs/Navigation/Navigation';
 import {getAllTaxRates} from '@libs/PolicyUtils';
@@ -110,7 +110,6 @@ function SearchTypeMenu({queryJSON}: SearchTypeMenuProps) {
             return {
                 ...baseMenuItem,
                 onPress: () => {
-                    clearAdvancedFilters();
                     setSearchContext(false);
                     Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: item?.query ?? '', name: item?.name}));
                 },
