From c40120b446852910739ffa7e7878690f86a3ba6a Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Wed, 25 Mar 2026 09:35:29 -0400 Subject: [PATCH 01/10] add loading props --- src/components/Search/FilterDropdowns/MultiSelectPopup.tsx | 3 +++ .../Search/SearchPageHeader/MultiSelectFilterPopup.tsx | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/Search/FilterDropdowns/MultiSelectPopup.tsx b/src/components/Search/FilterDropdowns/MultiSelectPopup.tsx index d66e146acecb..e6d1ab155c9b 100644 --- a/src/components/Search/FilterDropdowns/MultiSelectPopup.tsx +++ b/src/components/Search/FilterDropdowns/MultiSelectPopup.tsx @@ -40,6 +40,9 @@ type MultiSelectPopupProps = { /** Search input placeholder. Defaults to 'common.search' when not provided. */ searchPlaceholder?: string; + + /** Whether the data for the popover is loading */ + loading?: boolean; }; function MultiSelectPopup({label, value, items, closeOverlay, onChange, isSearchable, searchPlaceholder}: MultiSelectPopupProps) { diff --git a/src/components/Search/SearchPageHeader/MultiSelectFilterPopup.tsx b/src/components/Search/SearchPageHeader/MultiSelectFilterPopup.tsx index 1cf0404cf548..50af2ba45032 100644 --- a/src/components/Search/SearchPageHeader/MultiSelectFilterPopup.tsx +++ b/src/components/Search/SearchPageHeader/MultiSelectFilterPopup.tsx @@ -6,6 +6,7 @@ import useLocalize from '@hooks/useLocalize'; import type {TranslationPaths} from '@src/languages/types'; type MultiSelectFilterPopupProps = PopoverComponentProps & { + loading?: boolean; translationKey: TranslationPaths; items: Array>; value: Array>; @@ -13,13 +14,14 @@ type MultiSelectFilterPopupProps = PopoverComponentProps & { isSearchable?: boolean; }; -function MultiSelectFilterPopup({closeOverlay, translationKey, items, value, onChangeCallback, isSearchable}: MultiSelectFilterPopupProps) { +function MultiSelectFilterPopup({closeOverlay, loading, translationKey, items, value, onChangeCallback, isSearchable}: MultiSelectFilterPopupProps) { const {translate} = useLocalize(); return ( Date: Wed, 25 Mar 2026 09:41:23 -0400 Subject: [PATCH 02/10] add loading indicator --- .../FilterDropdowns/MultiSelectPopup.tsx | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/components/Search/FilterDropdowns/MultiSelectPopup.tsx b/src/components/Search/FilterDropdowns/MultiSelectPopup.tsx index e6d1ab155c9b..c976016e6c71 100644 --- a/src/components/Search/FilterDropdowns/MultiSelectPopup.tsx +++ b/src/components/Search/FilterDropdowns/MultiSelectPopup.tsx @@ -1,5 +1,6 @@ import React, {useCallback, useMemo, useState} from 'react'; import {View} from 'react-native'; +import ActivityIndicator from '@components/ActivityIndicator'; import Button from '@components/Button'; import SelectionList from '@components/SelectionList'; import MultiSelectListItem from '@components/SelectionList/ListItem/MultiSelectListItem'; @@ -8,8 +9,10 @@ import Text from '@components/Text'; import useDebouncedState from '@hooks/useDebouncedState'; import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; +import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; +import type {SkeletonSpanReasonAttributes} from '@libs/telemetry/useSkeletonSpan'; import CONST from '@src/CONST'; import type {Icon} from '@src/types/onyx/OnyxCommon'; @@ -45,9 +48,11 @@ type MultiSelectPopupProps = { loading?: boolean; }; -function MultiSelectPopup({label, value, items, closeOverlay, onChange, isSearchable, searchPlaceholder}: MultiSelectPopupProps) { +function MultiSelectPopup({label, loading, value, items, closeOverlay, onChange, isSearchable, searchPlaceholder}: MultiSelectPopupProps) { + const theme = useTheme(); const {translate} = useLocalize(); const styles = useThemeStyles(); + // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth const {isSmallScreenWidth} = useResponsiveLayout(); const {windowHeight} = useWindowDimensions(); @@ -102,18 +107,30 @@ function MultiSelectPopup({label, value, items, closeOverlay, [searchTerm, isSearchable, searchPlaceholder, translate, setSearchTerm, headerMessage], ); + const reasonAttributes: SkeletonSpanReasonAttributes = {context: 'MultiSelectPopupDataLoading'}; + return ( {isSmallScreenWidth && {label}} - + {!!loading && ( + + )} + + {!loading && ( + + )} From d15d6b6303eb0bf2d41a29d5665abc4d3f573423 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Wed, 25 Mar 2026 09:45:13 -0400 Subject: [PATCH 03/10] add new component --- .../Search/SearchPageHeader/FeedFilterPopup.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/components/Search/SearchPageHeader/FeedFilterPopup.tsx diff --git a/src/components/Search/SearchPageHeader/FeedFilterPopup.tsx b/src/components/Search/SearchPageHeader/FeedFilterPopup.tsx new file mode 100644 index 000000000000..5a2e18e73c08 --- /dev/null +++ b/src/components/Search/SearchPageHeader/FeedFilterPopup.tsx @@ -0,0 +1,16 @@ +import {PopoverComponentProps} from '../FilterDropdowns/DropdownButton'; +import MultiSelectFilterPopup from './MultiSelectFilterPopup'; + +function FeedFilterPopup({}: PopoverComponentProps) { + return ( + + ); +} + +export default FeedFilterPopup; From ce1490a21922c766118c83768f1910e6e7338df0 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Wed, 25 Mar 2026 09:47:10 -0400 Subject: [PATCH 04/10] add back imports --- .../SearchPageHeader/FeedFilterPopup.tsx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/components/Search/SearchPageHeader/FeedFilterPopup.tsx b/src/components/Search/SearchPageHeader/FeedFilterPopup.tsx index 5a2e18e73c08..f8f320148140 100644 --- a/src/components/Search/SearchPageHeader/FeedFilterPopup.tsx +++ b/src/components/Search/SearchPageHeader/FeedFilterPopup.tsx @@ -1,10 +1,23 @@ -import {PopoverComponentProps} from '../FilterDropdowns/DropdownButton'; +import {PopoverComponentProps} from '@components/Search/FilterDropdowns/DropdownButton'; +import useFeedKeysWithAssignedCards from '@hooks/useFeedKeysWithAssignedCards'; +import useLocalize from '@hooks/useLocalize'; +import useOnyx from '@hooks/useOnyx'; +import {getFeedOptions} from '@libs/SearchUIUtils'; +import ONYXKEYS from '@src/ONYXKEYS'; import MultiSelectFilterPopup from './MultiSelectFilterPopup'; -function FeedFilterPopup({}: PopoverComponentProps) { +function FeedFilterPopup({closeOverlay}: PopoverComponentProps) { + const {translate, localeCompare} = useLocalize(); + const feedKeysWithCards = useFeedKeysWithAssignedCards(); + + const [allFeeds] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER); + const [personalAndWorkspaceCards] = useOnyx(ONYXKEYS.DERIVED.PERSONAL_AND_WORKSPACE_CARD_LIST); + + const feedOptions = getFeedOptions(allFeeds, personalAndWorkspaceCards, translate, localeCompare, feedKeysWithCards); + return ( Date: Wed, 25 Mar 2026 09:50:50 -0400 Subject: [PATCH 05/10] use props instead --- .../SearchPageHeader/FeedFilterPopup.tsx | 29 +++++++++---------- .../SearchPageHeader/useSearchFiltersBar.tsx | 4 +-- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/components/Search/SearchPageHeader/FeedFilterPopup.tsx b/src/components/Search/SearchPageHeader/FeedFilterPopup.tsx index f8f320148140..9c6f085df8fd 100644 --- a/src/components/Search/SearchPageHeader/FeedFilterPopup.tsx +++ b/src/components/Search/SearchPageHeader/FeedFilterPopup.tsx @@ -1,27 +1,24 @@ -import {PopoverComponentProps} from '@components/Search/FilterDropdowns/DropdownButton'; -import useFeedKeysWithAssignedCards from '@hooks/useFeedKeysWithAssignedCards'; -import useLocalize from '@hooks/useLocalize'; -import useOnyx from '@hooks/useOnyx'; -import {getFeedOptions} from '@libs/SearchUIUtils'; -import ONYXKEYS from '@src/ONYXKEYS'; + +import { MultiSelectItem, MultiSelectItem } from '@components/Search/FilterDropdowns/MultiSelectPopup'; import MultiSelectFilterPopup from './MultiSelectFilterPopup'; -function FeedFilterPopup({closeOverlay}: PopoverComponentProps) { - const {translate, localeCompare} = useLocalize(); - const feedKeysWithCards = useFeedKeysWithAssignedCards(); +type FeedFilterPopupProps = { + items: Array> + value: Array> + closeOverlay: () => void; + onChangeCallback: (items: Array>) => void +} - const [allFeeds] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER); - const [personalAndWorkspaceCards] = useOnyx(ONYXKEYS.DERIVED.PERSONAL_AND_WORKSPACE_CARD_LIST); +function FeedFilterPopup({ closeOverlay, items, value, onChangeCallback }: FeedFilterPopupProps) { - const feedOptions = getFeedOptions(allFeeds, personalAndWorkspaceCards, translate, localeCompare, feedKeysWithCards); return ( ); } diff --git a/src/components/Search/SearchPageHeader/useSearchFiltersBar.tsx b/src/components/Search/SearchPageHeader/useSearchFiltersBar.tsx index b3e6d461ea1e..d77375991262 100644 --- a/src/components/Search/SearchPageHeader/useSearchFiltersBar.tsx +++ b/src/components/Search/SearchPageHeader/useSearchFiltersBar.tsx @@ -55,6 +55,7 @@ import {getEmptyObject} from '@src/types/utils/EmptyObject'; import type IconAsset from '@src/types/utils/IconAsset'; import type WithSentryLabel from '@src/types/utils/SentryLabel'; import DatePickerFilterPopup from './DatePickerFilterPopup'; +import FeedFilterPopup from './FeedFilterPopup'; import MultiSelectFilterPopup from './MultiSelectFilterPopup'; type FilterItem = WithSentryLabel & { @@ -328,9 +329,8 @@ function useSearchFiltersBar(queryJSON: SearchQueryJSON, isMobileSelectionModeEn updateFilterForm({feed: items.map((item) => item.value)}); }; const feedComponent = (props: PopoverComponentProps) => ( - Date: Wed, 25 Mar 2026 09:52:40 -0400 Subject: [PATCH 06/10] add a loading state to the component --- .../SearchPageHeader/FeedFilterPopup.tsx | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/components/Search/SearchPageHeader/FeedFilterPopup.tsx b/src/components/Search/SearchPageHeader/FeedFilterPopup.tsx index 9c6f085df8fd..831545aa6790 100644 --- a/src/components/Search/SearchPageHeader/FeedFilterPopup.tsx +++ b/src/components/Search/SearchPageHeader/FeedFilterPopup.tsx @@ -1,23 +1,38 @@ - -import { MultiSelectItem, MultiSelectItem } from '@components/Search/FilterDropdowns/MultiSelectPopup'; +import {useEffect} from 'react'; +import type {MultiSelectItem} from '@components/Search/FilterDropdowns/MultiSelectPopup'; +import useNetwork from '@hooks/useNetwork'; +import useOnyx from '@hooks/useOnyx'; +import {openSearchCardFiltersPage} from '@libs/actions/Search'; +import ONYXKEYS from '@src/ONYXKEYS'; import MultiSelectFilterPopup from './MultiSelectFilterPopup'; type FeedFilterPopupProps = { - items: Array> - value: Array> - closeOverlay: () => void; - onChangeCallback: (items: Array>) => void -} + items: Array>; + value: Array>; + closeOverlay: () => void; + onChangeCallback: (items: Array>) => void; +}; + +function FeedFilterPopup({closeOverlay, items, value, onChangeCallback}: FeedFilterPopupProps) { + const {isOffline} = useNetwork(); + const [areCardsLoaded] = useOnyx(ONYXKEYS.IS_SEARCH_FILTERS_CARD_DATA_LOADED); -function FeedFilterPopup({ closeOverlay, items, value, onChangeCallback }: FeedFilterPopupProps) { + useEffect(() => { + if (isOffline) { + return; + } + openSearchCardFiltersPage(); + }, [isOffline]); + const shouldShowLoadingState = !areCardsLoaded && !isOffline; return ( ); From f69f29d186149d3585fb2225148893056acfaf7e Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Wed, 25 Mar 2026 10:06:00 -0400 Subject: [PATCH 07/10] add isExpanded --- .../Search/FilterDropdowns/DropdownButton.tsx | 5 +++-- .../Search/SearchPageHeader/FeedFilterPopup.tsx | 10 ++++++---- .../Search/SearchPageHeader/useSearchFiltersBar.tsx | 7 +++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/components/Search/FilterDropdowns/DropdownButton.tsx b/src/components/Search/FilterDropdowns/DropdownButton.tsx index a5c970fea727..6d8cc2a1723c 100644 --- a/src/components/Search/FilterDropdowns/DropdownButton.tsx +++ b/src/components/Search/FilterDropdowns/DropdownButton.tsx @@ -20,6 +20,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type WithSentryLabel from '@src/types/utils/SentryLabel'; type PopoverComponentProps = { + isExpanded: boolean; closeOverlay: () => void; }; @@ -122,8 +123,8 @@ function DropdownButton({label, value, viewportOffsetTop, PopoverComponent, medi }, [isSmallScreenWidth, styles]); const popoverContent = useMemo(() => { - return PopoverComponent({closeOverlay: toggleOverlay}); - }, [PopoverComponent, toggleOverlay]); + return PopoverComponent({closeOverlay: toggleOverlay, isExpanded: isOverlayVisible}); + }, [PopoverComponent, toggleOverlay, isOverlayVisible]); return ( >; value: Array>; closeOverlay: () => void; onChangeCallback: (items: Array>) => void; }; -function FeedFilterPopup({closeOverlay, items, value, onChangeCallback}: FeedFilterPopupProps) { +function FeedFilterPopup({closeOverlay, items, value, isExpanded, onChangeCallback}: FeedFilterPopupProps) { const {isOffline} = useNetwork(); const [areCardsLoaded] = useOnyx(ONYXKEYS.IS_SEARCH_FILTERS_CARD_DATA_LOADED); useEffect(() => { - if (isOffline) { + if (isOffline || !isExpanded) { return; } openSearchCardFiltersPage(); - }, [isOffline]); + }, [isOffline, isExpanded]); const shouldShowLoadingState = !areCardsLoaded && !isOffline; @@ -30,6 +31,7 @@ function FeedFilterPopup({closeOverlay, items, value, onChangeCallback}: FeedFil ( ( ( ( ( ( ( Date: Wed, 25 Mar 2026 10:06:48 -0400 Subject: [PATCH 08/10] update loading state UI --- .../Search/FilterDropdowns/MultiSelectPopup.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/Search/FilterDropdowns/MultiSelectPopup.tsx b/src/components/Search/FilterDropdowns/MultiSelectPopup.tsx index c976016e6c71..fac68d17f9fb 100644 --- a/src/components/Search/FilterDropdowns/MultiSelectPopup.tsx +++ b/src/components/Search/FilterDropdowns/MultiSelectPopup.tsx @@ -115,11 +115,13 @@ function MultiSelectPopup({label, loading, value, items, close {!!loading && ( - + + + )} {!loading && ( From 38d739f0bd6aae4fef144e5e1d3803ca9df94e39 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Wed, 25 Mar 2026 10:13:16 -0400 Subject: [PATCH 09/10] add props to everywhere else --- .../SearchPageHeader/useSearchActionsBar.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/Search/SearchPageHeader/useSearchActionsBar.tsx b/src/components/Search/SearchPageHeader/useSearchActionsBar.tsx index 5494539d8f5d..1d652df374d8 100644 --- a/src/components/Search/SearchPageHeader/useSearchActionsBar.tsx +++ b/src/components/Search/SearchPageHeader/useSearchActionsBar.tsx @@ -104,7 +104,7 @@ function GroupCurrencyPopup({updateFilterForm, closeOverlay}: FilterBarPopupProp ); } -function FeedPopup({updateFilterForm, closeOverlay}: FilterBarPopupProps) { +function FeedPopup({updateFilterForm, closeOverlay, isExpanded}: FilterBarPopupProps) { const {translate, localeCompare} = useLocalize(); const feedKeysWithCards = useFeedKeysWithAssignedCards(); const [feed] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {selector: filterFeedSelector}); @@ -119,6 +119,7 @@ function FeedPopup({updateFilterForm, closeOverlay}: FilterBarPopupProps) { return ( ( ( + PopoverComponent: ({closeOverlay, isExpanded}) => ( @@ -256,6 +259,7 @@ function useSearchActionsBar(queryJSON: SearchQueryJSON, isMobileSelectionModeEn }; const hasComponent = (props: PopoverComponentProps) => ( ( ( + PopoverComponent: ({closeOverlay, isExpanded}) => ( @@ -343,6 +349,7 @@ function useSearchActionsBar(queryJSON: SearchQueryJSON, isMobileSelectionModeEn }; const statusComponent = (props: PopoverComponentProps) => ( ( + PopoverComponent: ({closeOverlay, isExpanded}) => ( Date: Wed, 25 Mar 2026 10:14:21 -0400 Subject: [PATCH 10/10] add loading state to new action bar as well --- .../SearchPageHeader/useSearchActionsBar.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/Search/SearchPageHeader/useSearchActionsBar.tsx b/src/components/Search/SearchPageHeader/useSearchActionsBar.tsx index 1d652df374d8..09112e0be21d 100644 --- a/src/components/Search/SearchPageHeader/useSearchActionsBar.tsx +++ b/src/components/Search/SearchPageHeader/useSearchActionsBar.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {useEffect} from 'react'; import type {ReactNode} from 'react'; import type {OnyxCollection} from 'react-native-onyx'; import type {PopoverComponentProps} from '@components/Search/FilterDropdowns/DropdownButton'; @@ -18,6 +18,7 @@ import useOnyx from '@hooks/useOnyx'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import {close} from '@libs/actions/Modal'; +import {openSearchCardFiltersPage} from '@libs/actions/Search'; import Navigation from '@libs/Navigation/Navigation'; import {buildFilterQueryWithSortDefaults} from '@libs/SearchQueryUtils'; import {filterValidHasValues, getFeedOptions, getGroupCurrencyOptions, getHasOptions, getStatusOptions, getWithdrawalTypeOptions, mapFiltersFormToLabelValueList} from '@libs/SearchUIUtils'; @@ -105,17 +106,29 @@ function GroupCurrencyPopup({updateFilterForm, closeOverlay}: FilterBarPopupProp } function FeedPopup({updateFilterForm, closeOverlay, isExpanded}: FilterBarPopupProps) { + const {isOffline} = useNetwork(); const {translate, localeCompare} = useLocalize(); const feedKeysWithCards = useFeedKeysWithAssignedCards(); + const [feed] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {selector: filterFeedSelector}); const [personalAndWorkspaceCards] = useOnyx(ONYXKEYS.DERIVED.PERSONAL_AND_WORKSPACE_CARD_LIST); const [allFeeds] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER); + const [areCardsLoaded] = useOnyx(ONYXKEYS.IS_SEARCH_FILTERS_CARD_DATA_LOADED); + + useEffect(() => { + if (isOffline || !isExpanded) { + return; + } + openSearchCardFiltersPage(); + }, [isOffline, isExpanded]); const updateFeedFilterForm = (items: Array>) => { updateFilterForm({feed: items.map((item) => item.value)}); }; + const feedOptions = getFeedOptions(allFeeds, personalAndWorkspaceCards, translate, localeCompare, feedKeysWithCards); const feedValue = feed ? feedOptions.filter((option) => feed.includes(option.value)) : []; + const shouldShowLoadingState = !areCardsLoaded && !isOffline; return ( );