From aaf38b55fcef5e3e75cf174b670d0d8f5602a63a Mon Sep 17 00:00:00 2001 From: Abdelrahman Khattab Date: Sun, 28 Sep 2025 18:23:17 +0200 Subject: [PATCH 1/7] Refactor AddDelegatePage and TaskAssigneeSelectorModal to use useSearchSelector hook --- .../Security/AddDelegate/AddDelegatePage.tsx | 105 ++++----------- src/pages/tasks/TaskAssigneeSelectorModal.tsx | 127 +++++------------- 2 files changed, 65 insertions(+), 167 deletions(-) diff --git a/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx b/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx index 6a434d1899c8c..400b25441220e 100644 --- a/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx +++ b/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx @@ -1,34 +1,28 @@ -import React, {useCallback, useEffect, useMemo, useState} from 'react'; +import React, {useCallback, useEffect, useMemo} from 'react'; import {View} from 'react-native'; import DelegateNoAccessWrapper from '@components/DelegateNoAccessWrapper'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; -import {useBetas} from '@components/OnyxListItemProvider'; -import {useOptionsList} from '@components/OptionListContextProvider'; import ScreenWrapper from '@components/ScreenWrapper'; import SelectionList from '@components/SelectionList'; import UserListItem from '@components/SelectionList/UserListItem'; -import useDebouncedState from '@hooks/useDebouncedState'; import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; +import useSearchSelector from '@hooks/useSearchSelector'; import useThemeStyles from '@hooks/useThemeStyles'; import {searchInServer} from '@libs/actions/Report'; -import memoize from '@libs/memoize'; import Navigation from '@libs/Navigation/Navigation'; -import {filterAndOrderOptions, getHeaderMessage, getValidOptions} from '@libs/OptionsListUtils'; +import {getHeaderMessage} from '@libs/OptionsListUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {Participant} from '@src/types/onyx/IOU'; -const memoizedGetValidOptions = memoize(getValidOptions, {maxSize: 5, monitoringName: 'AddDelegatePage.getValidOptions'}); - -function useOptions() { - const betas = useBetas(); - const [isLoading, setIsLoading] = useState(true); - const [searchValue, debouncedSearchValue, setSearchValue] = useDebouncedState(''); - const {options: optionsList, areOptionsInitialized} = useOptionsList(); +function AddDelegatePage() { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false, canBeMissing: true}); const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: true}); - const [countryCode] = useOnyx(ONYXKEYS.COUNTRY_CODE, {canBeMissing: false}); + const existingDelegates = useMemo( () => account?.delegatedAccess?.delegates?.reduce( @@ -42,78 +36,37 @@ function useOptions() { [account?.delegatedAccess?.delegates], ); - const defaultOptions = useMemo(() => { - const {recentReports, personalDetails, userToInvite, currentUserOption} = memoizedGetValidOptions( - { - reports: optionsList.reports, - personalDetails: optionsList.personalDetails, - }, - { - betas, - excludeLogins: {...CONST.EXPENSIFY_EMAILS_OBJECT, ...existingDelegates}, - }, - ); - - const headerMessage = getHeaderMessage((recentReports?.length || 0) + (personalDetails?.length || 0) !== 0, !!userToInvite, ''); - - if (isLoading) { - // eslint-disable-next-line react-compiler/react-compiler - setIsLoading(false); - } - - return { - userToInvite, - recentReports, - personalDetails, - currentUserOption, - headerMessage, - }; - }, [optionsList.reports, optionsList.personalDetails, betas, existingDelegates, isLoading]); - - const options = useMemo(() => { - const filteredOptions = filterAndOrderOptions(defaultOptions, debouncedSearchValue.trim(), countryCode, { - excludeLogins: {...CONST.EXPENSIFY_EMAILS_OBJECT, ...existingDelegates}, - maxRecentReportsToShow: CONST.IOU.MAX_RECENT_REPORTS_TO_SHOW, - }); - const headerMessage = getHeaderMessage( - (filteredOptions.recentReports?.length || 0) + (filteredOptions.personalDetails?.length || 0) !== 0, - !!filteredOptions.userToInvite, - debouncedSearchValue, - ); + const {searchTerm, setSearchTerm, availableOptions, areOptionsInitialized} = useSearchSelector({ + selectionMode: CONST.SEARCH_SELECTOR.SELECTION_MODE_SINGLE, + searchContext: CONST.SEARCH_SELECTOR.SEARCH_CONTEXT_GENERAL, + includeUserToInvite: true, + excludeLogins: {...CONST.EXPENSIFY_EMAILS_OBJECT, ...existingDelegates}, + includeRecentReports: true, + }); - return { - ...filteredOptions, - headerMessage, - }; - }, [debouncedSearchValue, defaultOptions, existingDelegates, countryCode]); - - return {...options, searchValue, debouncedSearchValue, setSearchValue, areOptionsInitialized}; -} -function AddDelegatePage() { - const {translate} = useLocalize(); - const styles = useThemeStyles(); - const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false, canBeMissing: true}); - const {userToInvite, recentReports, personalDetails, searchValue, debouncedSearchValue, setSearchValue, headerMessage, areOptionsInitialized} = useOptions(); + const headerMessage = useMemo(() => { + return getHeaderMessage((availableOptions.recentReports?.length || 0) + (availableOptions.personalDetails?.length || 0) !== 0, !!availableOptions.userToInvite, searchTerm); + }, [availableOptions, searchTerm]); const sections = useMemo(() => { const sectionsList = []; sectionsList.push({ title: translate('common.recents'), - data: recentReports, - shouldShow: recentReports?.length > 0, + data: availableOptions.recentReports, + shouldShow: availableOptions.recentReports?.length > 0, }); sectionsList.push({ title: translate('common.contacts'), - data: personalDetails, - shouldShow: personalDetails?.length > 0, + data: availableOptions.personalDetails, + shouldShow: availableOptions.personalDetails?.length > 0, }); - if (userToInvite) { + if (availableOptions.userToInvite) { sectionsList.push({ title: undefined, - data: [userToInvite], + data: [availableOptions.userToInvite], shouldShow: true, }); } @@ -130,15 +83,15 @@ function AddDelegatePage() { shouldShowSubscript: option.shouldShowSubscript ?? undefined, })), })); - }, [personalDetails, recentReports, translate, userToInvite]); + }, [availableOptions, translate]); const onSelectRow = useCallback((option: Participant) => { Navigation.navigate(ROUTES.SETTINGS_DELEGATE_ROLE.getRoute(option?.login ?? '')); }, []); useEffect(() => { - searchInServer(debouncedSearchValue); - }, [debouncedSearchValue]); + searchInServer(searchTerm); + }, [searchTerm]); return ( { - const {recentReports, personalDetails, userToInvite, currentUserOption} = memoizedGetValidOptions( - { - reports: optionsList.reports, - personalDetails: optionsList.personalDetails, - }, - { - betas, - excludeLogins: CONST.EXPENSIFY_EMAILS_OBJECT, - includeCurrentUser: true, - }, - ); - - const headerMessage = getHeaderMessage((recentReports?.length || 0) + (personalDetails?.length || 0) !== 0 || !!currentUserOption, !!userToInvite, ''); - - if (isLoading) { - // eslint-disable-next-line react-compiler/react-compiler - setIsLoading(false); - } - - return { - userToInvite, - recentReports, - personalDetails, - currentUserOption, - headerMessage, - }; - }, [optionsList.reports, optionsList.personalDetails, betas, isLoading]); - - const optionsWithoutCurrentUser = useMemo(() => { - if (!session?.accountID) { - return defaultOptions; - } - - return { - ...defaultOptions, - personalDetails: defaultOptions.personalDetails.filter((detail) => detail.accountID !== session.accountID), - recentReports: defaultOptions.recentReports.filter((report) => report.accountID !== session.accountID), - }; - }, [defaultOptions, session?.accountID]); - - const options = useMemo(() => { - const filteredOptions = filterAndOrderOptions(optionsWithoutCurrentUser, debouncedSearchValue.trim(), countryCode, { - excludeLogins: CONST.EXPENSIFY_EMAILS_OBJECT, - maxRecentReportsToShow: CONST.IOU.MAX_RECENT_REPORTS_TO_SHOW, - }); - const headerMessage = getHeaderMessage( - (filteredOptions.recentReports?.length || 0) + (filteredOptions.personalDetails?.length || 0) !== 0 || !!filteredOptions.currentUserOption, - !!filteredOptions.userToInvite, - debouncedSearchValue, - ); - - return { - ...filteredOptions, - headerMessage, - }; - }, [debouncedSearchValue, optionsWithoutCurrentUser, countryCode]); - - return {...options, searchValue, debouncedSearchValue, setSearchValue, areOptionsInitialized}; -} - function TaskAssigneeSelectorModal() { const styles = useThemeStyles(); const route = useRoute>(); @@ -116,7 +43,25 @@ function TaskAssigneeSelectorModal() { const [task] = useOnyx(ONYXKEYS.TASK, {canBeMissing: false}); const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false, canBeMissing: true}); const currentUserPersonalDetails = useCurrentUserPersonalDetails(); - const {userToInvite, recentReports, personalDetails, currentUserOption, searchValue, debouncedSearchValue, setSearchValue, headerMessage, areOptionsInitialized} = useOptions(); + + const {searchTerm, setSearchTerm, availableOptions, areOptionsInitialized} = useSearchSelector({ + selectionMode: CONST.SEARCH_SELECTOR.SELECTION_MODE_SINGLE, + searchContext: CONST.SEARCH_SELECTOR.SEARCH_CONTEXT_GENERAL, + includeUserToInvite: true, + excludeLogins: CONST.EXPENSIFY_EMAILS_OBJECT, + includeRecentReports: true, + getValidOptionsConfig: { + includeCurrentUser: true, + }, + }); + + const headerMessage = useMemo(() => { + return getHeaderMessage( + (availableOptions.recentReports?.length || 0) + (availableOptions.personalDetails?.length || 0) !== 0 || !!availableOptions.currentUserOption, + !!availableOptions.userToInvite, + searchTerm, + ); + }, [availableOptions, searchTerm]); const report: OnyxEntry = useMemo(() => { if (!route.params?.reportID) { @@ -134,30 +79,30 @@ function TaskAssigneeSelectorModal() { const sections = useMemo(() => { const sectionsList = []; - if (currentUserOption) { + if (availableOptions.currentUserOption) { sectionsList.push({ title: translate('newTaskPage.assignMe'), - data: [currentUserOption], + data: [availableOptions.currentUserOption], shouldShow: true, }); } sectionsList.push({ title: translate('common.recents'), - data: recentReports, - shouldShow: recentReports?.length > 0, + data: availableOptions.recentReports, + shouldShow: availableOptions.recentReports?.length > 0, }); sectionsList.push({ title: translate('common.contacts'), - data: personalDetails, - shouldShow: personalDetails?.length > 0, + data: availableOptions.personalDetails, + shouldShow: availableOptions.personalDetails?.length > 0, }); - if (userToInvite) { + if (availableOptions.userToInvite) { sectionsList.push({ title: '', - data: [userToInvite], + data: [availableOptions.userToInvite], shouldShow: true, }); } @@ -174,7 +119,7 @@ function TaskAssigneeSelectorModal() { shouldShowSubscript: option.shouldShowSubscript ?? undefined, })), })); - }, [currentUserOption, personalDetails, recentReports, translate, userToInvite]); + }, [availableOptions, translate]); const selectReport = useCallback( (option: ListItem) => { @@ -224,8 +169,8 @@ function TaskAssigneeSelectorModal() { const isTaskNonEditable = isTaskReport(report) && (!isTaskModifiable || !isOpen); useEffect(() => { - searchInServer(debouncedSearchValue); - }, [debouncedSearchValue]); + searchInServer(searchTerm); + }, [searchTerm]); return ( Date: Mon, 29 Sep 2025 01:22:07 +0200 Subject: [PATCH 2/7] using participant instead of listitem type --- src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx b/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx index 828bb9759f939..cfdfbd04ea805 100644 --- a/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx +++ b/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx @@ -4,7 +4,6 @@ import DelegateNoAccessWrapper from '@components/DelegateNoAccessWrapper'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; import SelectionList from '@components/SelectionListWithSections'; -import type {ListItem} from '@components/SelectionListWithSections/types'; import UserListItem from '@components/SelectionListWithSections/UserListItem'; import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; @@ -16,6 +15,7 @@ import {getHeaderMessage} from '@libs/OptionsListUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; +import type {Participant} from '@src/types/onyx/IOU'; function AddDelegatePage() { const {translate} = useLocalize(); @@ -85,7 +85,7 @@ function AddDelegatePage() { })); }, [availableOptions, translate]); - const onSelectRow = useCallback((option: ListItem) => { + const onSelectRow = useCallback((option: Participant) => { Navigation.navigate(ROUTES.SETTINGS_DELEGATE_ROLE.getRoute(option?.login ?? '')); }, []); From 88b2d7052f2a4272676153c02897454c83378b8f Mon Sep 17 00:00:00 2001 From: Abdelrahman Khattab Date: Fri, 3 Oct 2025 03:39:26 +0200 Subject: [PATCH 3/7] changing loginsToExclude: excludeLogins, to excludeLogins in useSearchSelectorBase --- src/hooks/useSearchSelector.base.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/useSearchSelector.base.ts b/src/hooks/useSearchSelector.base.ts index f19b75c33cd08..30832119f8f3f 100644 --- a/src/hooks/useSearchSelector.base.ts +++ b/src/hooks/useSearchSelector.base.ts @@ -181,7 +181,7 @@ function useSearchSelectorBase({ searchString: computedSearchTerm, maxElements: maxResults, includeUserToInvite, - loginsToExclude: excludeLogins, + excludeLogins, }); default: return getEmptyOptions(); From 8a63428f19ff8e748243e397977fcb551983b6e9 Mon Sep 17 00:00:00 2001 From: Abdelrahman Khattab Date: Fri, 3 Oct 2025 03:51:56 +0200 Subject: [PATCH 4/7] cleanup --- src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx b/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx index 5fb8fcd9fe841..cfdfbd04ea805 100644 --- a/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx +++ b/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx @@ -81,13 +81,11 @@ function AddDelegatePage() { isDisabled: option.isDisabled ?? undefined, login: option.login ?? undefined, shouldShowSubscript: option.shouldShowSubscript ?? undefined, - isSelected: option.login === selectedOption, })), })); }, [availableOptions, translate]); const onSelectRow = useCallback((option: Participant) => { - setSelectedOption(option?.login); Navigation.navigate(ROUTES.SETTINGS_DELEGATE_ROLE.getRoute(option?.login ?? '')); }, []); From e7dd556ccd363ddc661989fcb2e84c293338b600 Mon Sep 17 00:00:00 2001 From: Abdelrahman Khattab Date: Fri, 3 Oct 2025 04:02:11 +0200 Subject: [PATCH 5/7] fix: use debouncedSearchTerm for searchInServer calls in useSearchSelector migrations --- src/hooks/useSearchSelector.base.ts | 4 ++++ src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx | 6 +++--- src/pages/tasks/TaskAssigneeSelectorModal.tsx | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/hooks/useSearchSelector.base.ts b/src/hooks/useSearchSelector.base.ts index 30832119f8f3f..f1996f15ec6fb 100644 --- a/src/hooks/useSearchSelector.base.ts +++ b/src/hooks/useSearchSelector.base.ts @@ -78,6 +78,9 @@ type UseSearchSelectorReturn = { /** Current search term */ searchTerm: string; + /** Debounced search term */ + debouncedSearchTerm: string; + /** Function to update search term */ setSearchTerm: (value: string) => void; @@ -275,6 +278,7 @@ function useSearchSelectorBase({ return { searchTerm, + debouncedSearchTerm, setSearchTerm, searchOptions, availableOptions, diff --git a/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx b/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx index cfdfbd04ea805..e81e194742894 100644 --- a/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx +++ b/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx @@ -36,7 +36,7 @@ function AddDelegatePage() { [account?.delegatedAccess?.delegates], ); - const {searchTerm, setSearchTerm, availableOptions, areOptionsInitialized} = useSearchSelector({ + const {searchTerm, debouncedSearchTerm, setSearchTerm, availableOptions, areOptionsInitialized} = useSearchSelector({ selectionMode: CONST.SEARCH_SELECTOR.SELECTION_MODE_SINGLE, searchContext: CONST.SEARCH_SELECTOR.SEARCH_CONTEXT_GENERAL, includeUserToInvite: true, @@ -90,8 +90,8 @@ function AddDelegatePage() { }, []); useEffect(() => { - searchInServer(searchTerm); - }, [searchTerm]); + searchInServer(debouncedSearchTerm); + }, [debouncedSearchTerm]); return ( { - searchInServer(searchTerm); - }, [searchTerm]); + searchInServer(debouncedSearchTerm); + }, [debouncedSearchTerm]); return ( Date: Wed, 22 Oct 2025 01:26:44 +0200 Subject: [PATCH 6/7] fixing current assignee option and other refactorings --- .../Security/AddDelegate/AddDelegatePage.tsx | 22 +++++----- src/pages/tasks/TaskAssigneeSelectorModal.tsx | 43 +++++++++++++------ 2 files changed, 40 insertions(+), 25 deletions(-) diff --git a/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx b/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx index e81e194742894..8e584c878e747 100644 --- a/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx +++ b/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx @@ -1,4 +1,4 @@ -import React, {useCallback, useEffect, useMemo} from 'react'; +import React, {useEffect, useMemo} from 'react'; import {View} from 'react-native'; import DelegateNoAccessWrapper from '@components/DelegateNoAccessWrapper'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -12,10 +12,10 @@ import useThemeStyles from '@hooks/useThemeStyles'; import {searchInServer} from '@libs/actions/Report'; import Navigation from '@libs/Navigation/Navigation'; import {getHeaderMessage} from '@libs/OptionsListUtils'; +import type {OptionData} from '@libs/ReportUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -import type {Participant} from '@src/types/onyx/IOU'; function AddDelegatePage() { const {translate} = useLocalize(); @@ -32,21 +32,25 @@ function AddDelegatePage() { return prev; }, {} as Record, - ), + ) ?? {}, [account?.delegatedAccess?.delegates], ); - const {searchTerm, debouncedSearchTerm, setSearchTerm, availableOptions, areOptionsInitialized} = useSearchSelector({ + const {searchTerm, debouncedSearchTerm, setSearchTerm, availableOptions, areOptionsInitialized, toggleSelection} = useSearchSelector({ selectionMode: CONST.SEARCH_SELECTOR.SELECTION_MODE_SINGLE, searchContext: CONST.SEARCH_SELECTOR.SEARCH_CONTEXT_GENERAL, includeUserToInvite: true, excludeLogins: {...CONST.EXPENSIFY_EMAILS_OBJECT, ...existingDelegates}, includeRecentReports: true, + maxRecentReportsToShow: CONST.IOU.MAX_RECENT_REPORTS_TO_SHOW, + onSingleSelect: (option) => { + Navigation.navigate(ROUTES.SETTINGS_DELEGATE_ROLE.getRoute(option.login ?? '')); + }, }); const headerMessage = useMemo(() => { - return getHeaderMessage((availableOptions.recentReports?.length || 0) + (availableOptions.personalDetails?.length || 0) !== 0, !!availableOptions.userToInvite, searchTerm); - }, [availableOptions, searchTerm]); + return getHeaderMessage((availableOptions.recentReports?.length || 0) + (availableOptions.personalDetails?.length || 0) !== 0, !!availableOptions.userToInvite, debouncedSearchTerm); + }, [availableOptions, debouncedSearchTerm]); const sections = useMemo(() => { const sectionsList = []; @@ -85,10 +89,6 @@ function AddDelegatePage() { })); }, [availableOptions, translate]); - const onSelectRow = useCallback((option: Participant) => { - Navigation.navigate(ROUTES.SETTINGS_DELEGATE_ROLE.getRoute(option?.login ?? '')); - }, []); - useEffect(() => { searchInServer(debouncedSearchTerm); }, [debouncedSearchTerm]); @@ -107,7 +107,7 @@ function AddDelegatePage() { { + if (!session?.accountID) { + return availableOptions; + } + + return { + ...availableOptions, + personalDetails: availableOptions.personalDetails.filter((detail) => detail.accountID !== session.accountID), + recentReports: availableOptions.recentReports.filter((report) => report.accountID !== session.accountID), + }; + }, [availableOptions, session?.accountID]); + const headerMessage = useMemo(() => { return getHeaderMessage( - (availableOptions.recentReports?.length || 0) + (availableOptions.personalDetails?.length || 0) !== 0 || !!availableOptions.currentUserOption, - !!availableOptions.userToInvite, - searchTerm, + (optionsWithoutCurrentUser.recentReports?.length || 0) + (optionsWithoutCurrentUser.personalDetails?.length || 0) !== 0 || !!optionsWithoutCurrentUser.currentUserOption, + !!optionsWithoutCurrentUser.userToInvite, + debouncedSearchTerm, + false, + countryCode, ); - }, [availableOptions, searchTerm]); + }, [optionsWithoutCurrentUser, debouncedSearchTerm, countryCode]); const report: OnyxEntry = useMemo(() => { if (!route.params?.reportID) { @@ -79,30 +94,30 @@ function TaskAssigneeSelectorModal() { const sections = useMemo(() => { const sectionsList = []; - if (availableOptions.currentUserOption) { + if (optionsWithoutCurrentUser.currentUserOption) { sectionsList.push({ title: translate('newTaskPage.assignMe'), - data: [availableOptions.currentUserOption], + data: [optionsWithoutCurrentUser.currentUserOption], shouldShow: true, }); } sectionsList.push({ title: translate('common.recents'), - data: availableOptions.recentReports, - shouldShow: availableOptions.recentReports?.length > 0, + data: optionsWithoutCurrentUser.recentReports, + shouldShow: optionsWithoutCurrentUser.recentReports?.length > 0, }); sectionsList.push({ title: translate('common.contacts'), - data: availableOptions.personalDetails, - shouldShow: availableOptions.personalDetails?.length > 0, + data: optionsWithoutCurrentUser.personalDetails, + shouldShow: optionsWithoutCurrentUser.personalDetails?.length > 0, }); - if (availableOptions.userToInvite) { + if (optionsWithoutCurrentUser.userToInvite) { sectionsList.push({ title: '', - data: [availableOptions.userToInvite], + data: [optionsWithoutCurrentUser.userToInvite], shouldShow: true, }); } @@ -119,7 +134,7 @@ function TaskAssigneeSelectorModal() { shouldShowSubscript: option.shouldShowSubscript ?? undefined, })), })); - }, [availableOptions, translate]); + }, [optionsWithoutCurrentUser, translate]); const selectReport = useCallback( (option: ListItem) => { From 0f82ad782f422c993355c2d67528859fd79100b9 Mon Sep 17 00:00:00 2001 From: Abdelrahman Khattab Date: Wed, 22 Oct 2025 01:40:42 +0200 Subject: [PATCH 7/7] fixing eslint --- src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx b/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx index 8e584c878e747..bfa230156d98d 100644 --- a/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx +++ b/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx @@ -12,7 +12,6 @@ import useThemeStyles from '@hooks/useThemeStyles'; import {searchInServer} from '@libs/actions/Report'; import Navigation from '@libs/Navigation/Navigation'; import {getHeaderMessage} from '@libs/OptionsListUtils'; -import type {OptionData} from '@libs/ReportUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES';