Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ function SearchTypeMenuPopover({queryJSON, searchName}: SearchTypeMenuNarrowProp
const {singleExecution} = useSingleExecution();
const {windowHeight} = useWindowDimensions();
const {translate} = useLocalize();
const {hash, policyID, groupBy} = queryJSON;
const {hash, groupBy} = queryJSON;
const {showDeleteModal, DeleteConfirmModal} = useDeleteSavedSearch();
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
const [session] = useOnyx(ONYXKEYS.SESSION);
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true});
const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false});
const personalDetails = usePersonalDetails();
const [reports = {}] = useOnyx(ONYXKEYS.COLLECTION.REPORT);
const [reports = {}] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: true});
const taxRates = getAllTaxRates();
const [userCardList] = useOnyx(ONYXKEYS.CARD_LIST);
const [workspaceCardFeeds] = useOnyx(ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST);
const [userCardList] = useOnyx(ONYXKEYS.CARD_LIST, {canBeMissing: true});
const [workspaceCardFeeds] = useOnyx(ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST, {canBeMissing: true});
const allCards = useMemo(() => mergeCardListWithWorkspaceFeeds(workspaceCardFeeds ?? CONST.EMPTY_OBJECT, userCardList), [userCardList, workspaceCardFeeds]);
const {unmodifiedPaddings} = useSafeAreaPaddings();
const {canUseLeftHandBar} = usePermissions();
Expand Down Expand Up @@ -102,7 +102,7 @@ function SearchTypeMenuPopover({queryJSON, searchName}: SearchTypeMenuNarrowProp
(itemName: string, itemHash: number, itemQuery: string) => getOverflowMenuUtil(itemName, itemHash, itemQuery, showDeleteModal, true, closeMenu),
[closeMenu, showDeleteModal],
);
const [savedSearches] = useOnyx(ONYXKEYS.SAVED_SEARCHES);
const [savedSearches] = useOnyx(ONYXKEYS.SAVED_SEARCHES, {canBeMissing: true});
const createSavedSearchMenuItem = useCallback(
(item: SaveSearchItem, key: string, index: number) => {
let savedSearchTitle = item.name;
Expand Down Expand Up @@ -170,7 +170,7 @@ function SearchTypeMenuPopover({queryJSON, searchName}: SearchTypeMenuNarrowProp
text: translate(item.translationPath),
onSelected: singleExecution(() => {
clearAllFilters();
Navigation.navigate(item.getRoute(policyID));
Navigation.navigate(item.getRoute());
}),
isSelected,
icon: item.icon,
Expand Down Expand Up @@ -199,7 +199,7 @@ function SearchTypeMenuPopover({queryJSON, searchName}: SearchTypeMenuNarrowProp
}

return items;
}, [typeMenuItems, title, currentSavedSearch, activeItemIndex, translate, singleExecution, theme.iconSuccessFill, theme.icon, theme.border, policyID, closeMenu, shouldGroupByReports]);
}, [typeMenuItems, title, currentSavedSearch, activeItemIndex, translate, singleExecution, theme.iconSuccessFill, theme.icon, theme.border, closeMenu, shouldGroupByReports]);

const allMenuItems = useMemo(() => {
const items = [];
Expand Down
12 changes: 9 additions & 3 deletions src/pages/Search/AdvancedSearchFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ const typeFiltersKeys: Record<string, Array<Array<ValueOf<typeof CONST.SEARCH.SY
],
],
[CONST.SEARCH.DATA_TYPES.INVOICE]: [
[CONST.SEARCH.SYNTAX_FILTER_KEYS.KEYWORD, CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM, CONST.SEARCH.SYNTAX_FILTER_KEYS.TO],
[CONST.SEARCH.SYNTAX_FILTER_KEYS.KEYWORD, CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM, CONST.SEARCH.SYNTAX_FILTER_KEYS.TO, CONST.SEARCH.SYNTAX_FILTER_KEYS.POLICY_ID],
[
CONST.SEARCH.SYNTAX_FILTER_KEYS.MERCHANT,
CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE,
Expand All @@ -222,7 +222,7 @@ const typeFiltersKeys: Record<string, Array<Array<ValueOf<typeof CONST.SEARCH.SY
],
],
[CONST.SEARCH.DATA_TYPES.TRIP]: [
[CONST.SEARCH.SYNTAX_FILTER_KEYS.KEYWORD, CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM, CONST.SEARCH.SYNTAX_FILTER_KEYS.TO],
[CONST.SEARCH.SYNTAX_FILTER_KEYS.KEYWORD, CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM, CONST.SEARCH.SYNTAX_FILTER_KEYS.TO, CONST.SEARCH.SYNTAX_FILTER_KEYS.POLICY_ID],
[
CONST.SEARCH.SYNTAX_FILTER_KEYS.MERCHANT,
CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE,
Expand All @@ -243,7 +243,13 @@ const typeFiltersKeys: Record<string, Array<Array<ValueOf<typeof CONST.SEARCH.SY
],
],
[CONST.SEARCH.DATA_TYPES.CHAT]: [
[CONST.SEARCH.SYNTAX_FILTER_KEYS.KEYWORD, CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM, CONST.SEARCH.SYNTAX_FILTER_KEYS.TO, CONST.SEARCH.SYNTAX_FILTER_KEYS.IN],
[
CONST.SEARCH.SYNTAX_FILTER_KEYS.KEYWORD,
CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM,
CONST.SEARCH.SYNTAX_FILTER_KEYS.TO,
CONST.SEARCH.SYNTAX_FILTER_KEYS.IN,
CONST.SEARCH.SYNTAX_FILTER_KEYS.POLICY_ID,
],
[CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE],
],
[CONST.SEARCH.DATA_TYPES.TASK]: [
Expand Down
14 changes: 7 additions & 7 deletions src/pages/Search/SearchTypeMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function SearchTypeMenu({queryJSON}: SearchTypeMenuProps) {
const {singleExecution} = useSingleExecution();
const {translate} = useLocalize();
const {canUseLeftHandBar} = usePermissions();
const [savedSearches] = useOnyx(ONYXKEYS.SAVED_SEARCHES);
const [savedSearches] = useOnyx(ONYXKEYS.SAVED_SEARCHES, {canBeMissing: true});
const {isOffline} = useNetwork();
const shouldShowSavedSearchesMenuItemTitle = Object.values(savedSearches ?? {}).filter((s) => s.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || isOffline).length > 0;
const isFocused = useIsFocused();
Expand All @@ -61,12 +61,12 @@ function SearchTypeMenu({queryJSON}: SearchTypeMenuProps) {
shouldShowSavedSearchesMenuItemTitle && isFocused,
);
const {showDeleteModal, DeleteConfirmModal} = useDeleteSavedSearch();
const [session] = useOnyx(ONYXKEYS.SESSION);
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false});
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true});
const personalDetails = usePersonalDetails();
const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT);
const [userCardList] = useOnyx(ONYXKEYS.CARD_LIST);
const [workspaceCardFeeds] = useOnyx(ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST);
const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: true});
const [userCardList] = useOnyx(ONYXKEYS.CARD_LIST, {canBeMissing: true});
const [workspaceCardFeeds] = useOnyx(ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST, {canBeMissing: true});
const allCards = useMemo(() => mergeCardListWithWorkspaceFeeds(workspaceCardFeeds ?? CONST.EMPTY_OBJECT, userCardList), [userCardList, workspaceCardFeeds]);
const taxRates = getAllTaxRates();
const {clearSelectedTransactions} = useSearchContext();
Expand Down Expand Up @@ -214,7 +214,7 @@ function SearchTypeMenu({queryJSON}: SearchTypeMenuProps) {
const onPress = singleExecution(() => {
clearAllFilters();
clearSelectedTransactions();
Navigation.navigate(item.getRoute(queryJSON?.policyID));
Navigation.navigate(item.getRoute());
});

return (
Expand Down