diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 707c66b89c8c..56e97e4a27a4 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -410,6 +410,8 @@ const ONYXKEYS = { /** Stores the information about currently edited advanced approval workflow */ APPROVAL_WORKFLOW: 'approvalWorkflow', + /** Stores the user search value for persistance across the screens */ + ROOM_MEMBERS_USER_SEARCH_PHRASE: 'roomMembersUserSearchPhrase', /** Stores information about recently uploaded spreadsheet file */ IMPORTED_SPREADSHEET: 'importedSpreadsheet', @@ -950,6 +952,7 @@ type OnyxValuesMapping = { [ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END]: number; [ONYXKEYS.NVP_WORKSPACE_TOOLTIP]: OnyxTypes.WorkspaceTooltip; [ONYXKEYS.NVP_PRIVATE_CANCELLATION_DETAILS]: OnyxTypes.CancellationDetails[]; + [ONYXKEYS.ROOM_MEMBERS_USER_SEARCH_PHRASE]: string; [ONYXKEYS.APPROVAL_WORKFLOW]: OnyxTypes.ApprovalWorkflowOnyx; [ONYXKEYS.IMPORTED_SPREADSHEET]: OnyxTypes.ImportedSpreadsheet; [ONYXKEYS.LAST_ROUTE]: string; diff --git a/src/ROUTES.ts b/src/ROUTES.ts index f4eee3bb7971..e9bf453796b4 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -362,7 +362,10 @@ const ROUTES = { }, ROOM_INVITE: { route: 'r/:reportID/invite/:role?', - getRoute: (reportID: string, role?: string) => `r/${reportID}/invite/${role ?? ''}` as const, + getRoute: (reportID: string, role?: string) => { + const route = role ? (`r/${reportID}/invite/${role}` as const) : (`r/${reportID}/invite` as const); + return route; + }, }, MONEY_REQUEST_HOLD_REASON: { route: ':type/edit/reason/:transactionID?', diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index 5eb3484a4a69..f2461f400678 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -29,7 +29,6 @@ import * as SessionUtils from '@libs/SessionUtils'; import ConnectionCompletePage from '@pages/ConnectionCompletePage'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; import DesktopSignInRedirectPage from '@pages/signin/DesktopSignInRedirectPage'; -import SearchInputManager from '@pages/workspace/SearchInputManager'; import * as App from '@userActions/App'; import * as Download from '@userActions/Download'; import * as Modal from '@userActions/Modal'; @@ -198,8 +197,6 @@ const modalScreenListeners = { Modal.setModalVisibility(false); }, beforeRemove: () => { - // Clear search input (WorkspaceInvitePage) when modal is closed - SearchInputManager.searchInput = ''; Modal.setModalVisibility(false); Modal.willAlertModalBecomeVisible(false); }, diff --git a/src/libs/actions/RoomMembersUserSearchPhrase.ts b/src/libs/actions/RoomMembersUserSearchPhrase.ts new file mode 100644 index 000000000000..1395b1ecec7f --- /dev/null +++ b/src/libs/actions/RoomMembersUserSearchPhrase.ts @@ -0,0 +1,15 @@ +import Onyx from 'react-native-onyx'; +import ONYXKEYS from '@src/ONYXKEYS'; + +function clearUserSearchPhrase() { + Onyx.merge(ONYXKEYS.ROOM_MEMBERS_USER_SEARCH_PHRASE, ''); +} + +/** + * Persists user search phrase from the serch input across the screens. + */ +function updateUserSearchPhrase(value: string) { + Onyx.merge(ONYXKEYS.ROOM_MEMBERS_USER_SEARCH_PHRASE, value); +} + +export {clearUserSearchPhrase, updateUserSearchPhrase}; diff --git a/src/pages/InviteReportParticipantsPage.tsx b/src/pages/InviteReportParticipantsPage.tsx index 5a3b69aa628f..0308982f382c 100644 --- a/src/pages/InviteReportParticipantsPage.tsx +++ b/src/pages/InviteReportParticipantsPage.tsx @@ -1,7 +1,7 @@ import React, {useCallback, useEffect, useMemo, useState} from 'react'; import type {SectionListData} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; -import {withOnyx} from 'react-native-onyx'; +import {useOnyx, withOnyx} from 'react-native-onyx'; import FormAlertWithSubmitButton from '@components/FormAlertWithSubmitButton'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import {useOptionsList} from '@components/OptionListContextProvider'; @@ -14,6 +14,7 @@ import type {WithNavigationTransitionEndProps} from '@components/withNavigationT import useDebouncedState from '@hooks/useDebouncedState'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import * as UserSearchPhraseActions from '@libs/actions/RoomMembersUserSearchPhrase'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import * as LoginUtils from '@libs/LoginUtils'; import Navigation from '@libs/Navigation/Navigation'; @@ -28,7 +29,6 @@ import ROUTES from '@src/ROUTES'; import type {InvitedEmailsToAccountIDs, PersonalDetailsList} from '@src/types/onyx'; import type {WithReportOrNotFoundProps} from './home/report/withReportOrNotFound'; import withReportOrNotFound from './home/report/withReportOrNotFound'; -import SearchInputManager from './workspace/SearchInputManager'; type InviteReportParticipantsPageOnyxProps = { /** All of the personal details for everyone */ @@ -46,13 +46,13 @@ function InviteReportParticipantsPage({betas, personalDetails, report, didScreen const styles = useThemeStyles(); const {translate} = useLocalize(); - const [searchTerm, debouncedSearchTerm, setSearchTerm] = useDebouncedState(''); + const [userSearchPhrase] = useOnyx(ONYXKEYS.ROOM_MEMBERS_USER_SEARCH_PHRASE); + const [searchValue, debouncedSearchTerm, setSearchValue] = useDebouncedState(userSearchPhrase ?? ''); const [selectedOptions, setSelectedOptions] = useState([]); useEffect(() => { - setSearchTerm(SearchInputManager.searchInput); - // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps - }, []); + UserSearchPhraseActions.updateUserSearchPhrase(debouncedSearchTerm); + }, [debouncedSearchTerm]); // Any existing participants and Expensify emails should not be eligible for invitation const excludedUsers = useMemo( @@ -104,8 +104,8 @@ function InviteReportParticipantsPage({betas, personalDetails, report, didScreen filterSelectedOptions = selectedOptions.filter((option) => { const accountID = option?.accountID; const isOptionInPersonalDetails = inviteOptions.personalDetails.some((personalDetail) => accountID && personalDetail?.accountID === accountID); - const searchValue = OptionsListUtils.getSearchValueForPhoneOrEmail(debouncedSearchTerm); - const isPartOfSearchTerm = !!option.text?.toLowerCase().includes(searchValue) || !!option.login?.toLowerCase().includes(searchValue); + const processedSearchValue = OptionsListUtils.getSearchValueForPhoneOrEmail(debouncedSearchTerm); + const isPartOfSearchTerm = !!option.text?.toLowerCase().includes(processedSearchValue) || !!option.login?.toLowerCase().includes(processedSearchValue); return isPartOfSearchTerm || isOptionInPersonalDetails; }); } @@ -183,22 +183,22 @@ function InviteReportParticipantsPage({betas, personalDetails, report, didScreen }, [selectedOptions, backRoute, reportID, validate]); const headerMessage = useMemo(() => { - const searchValue = debouncedSearchTerm.trim().toLowerCase(); + const processedLogin = debouncedSearchTerm.trim().toLowerCase(); const expensifyEmails = CONST.EXPENSIFY_EMAILS as string[]; - if (!inviteOptions.userToInvite && expensifyEmails.includes(searchValue)) { + if (!inviteOptions.userToInvite && expensifyEmails.includes(processedLogin)) { return translate('messages.errorMessageInvalidEmail'); } if ( !inviteOptions.userToInvite && excludedUsers.includes( - PhoneNumber.parsePhoneNumber(LoginUtils.appendCountryCode(searchValue)).possible - ? PhoneNumber.addSMSDomainIfPhoneNumber(LoginUtils.appendCountryCode(searchValue)) - : searchValue, + PhoneNumber.parsePhoneNumber(LoginUtils.appendCountryCode(processedLogin)).possible + ? PhoneNumber.addSMSDomainIfPhoneNumber(LoginUtils.appendCountryCode(processedLogin)) + : processedLogin, ) ) { - return translate('messages.userIsAlreadyMember', {login: searchValue, name: reportName ?? ''}); + return translate('messages.userIsAlreadyMember', {login: processedLogin, name: reportName ?? ''}); } - return OptionsListUtils.getHeaderMessage(inviteOptions.recentReports.length + inviteOptions.personalDetails.length !== 0, !!inviteOptions.userToInvite, searchValue); + return OptionsListUtils.getHeaderMessage(inviteOptions.recentReports.length + inviteOptions.personalDetails.length !== 0, !!inviteOptions.userToInvite, processedLogin); }, [debouncedSearchTerm, inviteOptions.userToInvite, inviteOptions.recentReports.length, inviteOptions.personalDetails.length, excludedUsers, translate, reportName]); const footerContent = useMemo( @@ -207,7 +207,7 @@ function InviteReportParticipantsPage({betas, personalDetails, report, didScreen isDisabled={!selectedOptions.length} buttonText={translate('common.invite')} onSubmit={() => { - SearchInputManager.searchInput = ''; + UserSearchPhraseActions.clearUserSearchPhrase(); inviteUsers(); }} containerStyles={[styles.flexReset, styles.flexGrow0, styles.flexShrink0, styles.flexBasisAuto]} @@ -236,10 +236,9 @@ function InviteReportParticipantsPage({betas, personalDetails, report, didScreen sections={sections} ListItem={InviteMemberListItem} textInputLabel={translate('selectionList.nameEmailOrPhoneNumber')} - textInputValue={searchTerm} + textInputValue={searchValue} onChangeText={(value) => { - SearchInputManager.searchInput = value; - setSearchTerm(value); + setSearchValue(value); }} headerMessage={headerMessage} onSelectRow={toggleOption} diff --git a/src/pages/ReportParticipantsPage.tsx b/src/pages/ReportParticipantsPage.tsx index c99ef44688cb..ad7c73b50307 100755 --- a/src/pages/ReportParticipantsPage.tsx +++ b/src/pages/ReportParticipantsPage.tsx @@ -17,6 +17,7 @@ import TableListItem from '@components/SelectionList/TableListItem'; import type {ListItem, SelectionListHandle} from '@components/SelectionList/types'; import SelectionListWithModal from '@components/SelectionListWithModal'; import Text from '@components/Text'; +import useDebouncedState from '@hooks/useDebouncedState'; import useLocalize from '@hooks/useLocalize'; import useMobileSelectionMode from '@hooks/useMobileSelectionMode'; import useNetwork from '@hooks/useNetwork'; @@ -25,6 +26,7 @@ import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import {turnOffMobileSelectionMode} from '@libs/actions/MobileSelectionMode'; import * as Report from '@libs/actions/Report'; +import * as UserSearchPhraseActions from '@libs/actions/RoomMembersUserSearchPhrase'; import Navigation from '@libs/Navigation/Navigation'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; @@ -34,7 +36,6 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {WithReportOrNotFoundProps} from './home/report/withReportOrNotFound'; import withReportOrNotFound from './home/report/withReportOrNotFound'; -import SearchInputManager from './workspace/SearchInputManager'; type MemberOption = Omit & {accountID: number}; @@ -47,6 +48,7 @@ function ReportParticipantsPage({report}: WithReportOrNotFoundProps) { const {shouldUseNarrowLayout, isSmallScreenWidth} = useResponsiveLayout(); const selectionListRef = useRef(null); const textInputRef = useRef(null); + const [userSearchPhrase] = useOnyx(ONYXKEYS.ROOM_MEMBERS_USER_SEARCH_PHRASE); const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID ?? -1}`); const {selectionMode} = useMobileSelectionMode(); const [session] = useOnyx(ONYXKEYS.SESSION); @@ -57,15 +59,19 @@ function ReportParticipantsPage({report}: WithReportOrNotFoundProps) { const isFocused = useIsFocused(); const {isOffline} = useNetwork(); const canSelectMultiple = isGroupChat && isCurrentUserAdmin && (isSmallScreenWidth ? selectionMode?.isEnabled : true); - const [searchValue, setSearchValue] = useState(''); + const [searchValue, debouncedSearchValue, setSearchValue] = useDebouncedState(''); useEffect( () => () => { - SearchInputManager.searchInput = ''; + UserSearchPhraseActions.clearUserSearchPhrase(); }, [], ); + useEffect(() => { + UserSearchPhraseActions.updateUserSearchPhrase(debouncedSearchValue); + }, [debouncedSearchValue]); + useEffect(() => { if (isFocused) { return; @@ -96,12 +102,12 @@ function ReportParticipantsPage({report}: WithReportOrNotFoundProps) { return; } if (shouldShowTextInput) { - setSearchValue(SearchInputManager.searchInput); + setSearchValue(userSearchPhrase ?? ''); } else { - SearchInputManager.searchInput = ''; + UserSearchPhraseActions.clearUserSearchPhrase(); setSearchValue(''); } - }, [isFocused, shouldShowTextInput]); + }, [isFocused, setSearchValue, shouldShowTextInput, userSearchPhrase]); const getParticipants = () => { let result: MemberOption[] = []; @@ -186,7 +192,6 @@ function ReportParticipantsPage({report}: WithReportOrNotFoundProps) { * Open the modal to invite a user */ const inviteUser = useCallback(() => { - setSearchValue(''); Navigation.navigate(ROUTES.REPORT_PARTICIPANTS_INVITE.getRoute(report.reportID)); }, [report]); @@ -199,7 +204,7 @@ function ReportParticipantsPage({report}: WithReportOrNotFoundProps) { const accountIDsToRemove = selectedMembers.filter((id) => id !== currentUserAccountID); Report.removeFromGroupChat(report.reportID, accountIDsToRemove); setSearchValue(''); - SearchInputManager.searchInput = ''; + UserSearchPhraseActions.clearUserSearchPhrase(); setSelectedMembers([]); setRemoveMembersConfirmModalVisible(false); }; @@ -404,7 +409,6 @@ function ReportParticipantsPage({report}: WithReportOrNotFoundProps) { textInputLabel={translate('selectionList.findMember')} textInputValue={searchValue} onChangeText={(value) => { - SearchInputManager.searchInput = value; setSearchValue(value); }} headerMessage={headerMessage} diff --git a/src/pages/RoomInvitePage.tsx b/src/pages/RoomInvitePage.tsx index 6d0e7bce3efc..0384cb947b2f 100644 --- a/src/pages/RoomInvitePage.tsx +++ b/src/pages/RoomInvitePage.tsx @@ -18,6 +18,7 @@ import useDebouncedState from '@hooks/useDebouncedState'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ReportActions from '@libs/actions/Report'; +import * as UserSearchPhraseActions from '@libs/actions/RoomMembersUserSearchPhrase'; import {READ_COMMANDS} from '@libs/API/types'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import HttpUtils from '@libs/HttpUtils'; @@ -38,7 +39,6 @@ import type {Policy} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import type {WithReportOrNotFoundProps} from './home/report/withReportOrNotFound'; import withReportOrNotFound from './home/report/withReportOrNotFound'; -import SearchInputManager from './workspace/SearchInputManager'; type RoomInvitePageProps = WithReportOrNotFoundProps & WithNavigationTransitionEndProps & StackScreenProps; @@ -53,15 +53,12 @@ function RoomInvitePage({ }: RoomInvitePageProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); - const [searchTerm, debouncedSearchTerm, setSearchTerm] = useDebouncedState(''); + const [userSearchPhrase] = useOnyx(ONYXKEYS.ROOM_MEMBERS_USER_SEARCH_PHRASE); + const [searchTerm, debouncedSearchTerm, setSearchTerm] = useDebouncedState(userSearchPhrase ?? ''); const [selectedOptions, setSelectedOptions] = useState([]); const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false}); - const {options, areOptionsInitialized} = useOptionsList(); - useEffect(() => { - setSearchTerm(SearchInputManager.searchInput); - // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps - }, []); + const {options, areOptionsInitialized} = useOptionsList(); // Any existing participants and Expensify emails should not be eligible for invitation const excludedUsers = useMemo(() => { @@ -207,7 +204,7 @@ function RoomInvitePage({ if (reportID) { Report.inviteToRoom(reportID, invitedEmailsToAccountIDs); } - SearchInputManager.searchInput = ''; + UserSearchPhraseActions.clearUserSearchPhrase(); Navigation.navigate(backRoute); }, [selectedOptions, backRoute, reportID, validate]); @@ -239,6 +236,7 @@ function RoomInvitePage({ }, [debouncedSearchTerm, inviteOptions.userToInvite, inviteOptions.personalDetails, excludedUsers, translate, reportName]); useEffect(() => { + UserSearchPhraseActions.updateUserSearchPhrase(debouncedSearchTerm); ReportActions.searchInServer(debouncedSearchTerm); }, [debouncedSearchTerm]); @@ -265,7 +263,6 @@ function RoomInvitePage({ textInputLabel={translate('selectionList.nameEmailOrPhoneNumber')} textInputValue={searchTerm} onChangeText={(value) => { - SearchInputManager.searchInput = value; setSearchTerm(value); }} headerMessage={headerMessage} diff --git a/src/pages/RoomMembersPage.tsx b/src/pages/RoomMembersPage.tsx index fb7ec1f20d06..41003d9bfb8b 100644 --- a/src/pages/RoomMembersPage.tsx +++ b/src/pages/RoomMembersPage.tsx @@ -19,11 +19,13 @@ import SelectionListWithModal from '@components/SelectionListWithModal'; import Text from '@components/Text'; import type {WithCurrentUserPersonalDetailsProps} from '@components/withCurrentUserPersonalDetails'; import withCurrentUserPersonalDetails from '@components/withCurrentUserPersonalDetails'; +import useDebouncedState from '@hooks/useDebouncedState'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import {turnOffMobileSelectionMode} from '@libs/actions/MobileSelectionMode'; +import * as UserSearchPhraseActions from '@libs/actions/RoomMembersUserSearchPhrase'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import localeCompare from '@libs/LocaleCompare'; import Navigation from '@libs/Navigation/Navigation'; @@ -42,7 +44,6 @@ import type {Session} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import type {WithReportOrNotFoundProps} from './home/report/withReportOrNotFound'; import withReportOrNotFound from './home/report/withReportOrNotFound'; -import SearchInputManager from './workspace/SearchInputManager'; type RoomMembersPageOnyxProps = { session: OnyxEntry; @@ -58,7 +59,8 @@ function RoomMembersPage({report, session, policies}: RoomMembersPageProps) { const {formatPhoneNumber, translate} = useLocalize(); const [selectedMembers, setSelectedMembers] = useState([]); const [removeMembersConfirmModalVisible, setRemoveMembersConfirmModalVisible] = useState(false); - const [searchValue, setSearchValue] = useState(''); + const [userSearchPhrase] = useOnyx(ONYXKEYS.ROOM_MEMBERS_USER_SEARCH_PHRASE); + const [searchValue, debouncedSearchTerm, setSearchValue] = useDebouncedState(''); const [didLoadRoomMembers, setDidLoadRoomMembers] = useState(false); const personalDetails = usePersonalDetails() || CONST.EMPTY_OBJECT; const policy = useMemo(() => policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID ?? ''}`], [policies, report?.policyID]); @@ -71,12 +73,13 @@ function RoomMembersPage({report, session, policies}: RoomMembersPageProps) { const [selectionMode] = useOnyx(ONYXKEYS.MOBILE_SELECTION_MODE); const canSelectMultiple = isSmallScreenWidth ? selectionMode?.isEnabled : true; - useEffect( - () => () => { - SearchInputManager.searchInput = ''; - }, - [], - ); + useEffect(() => { + setSearchValue(userSearchPhrase ?? ''); + }, [isFocusedScreen, setSearchValue, userSearchPhrase]); + + useEffect(() => { + UserSearchPhraseActions.updateUserSearchPhrase(debouncedSearchTerm); + }, [debouncedSearchTerm]); useEffect(() => { if (isFocusedScreen) { @@ -97,6 +100,7 @@ function RoomMembersPage({report, session, policies}: RoomMembersPageProps) { }, [report]); useEffect(() => { + UserSearchPhraseActions.clearUserSearchPhrase(); getRoomMembers(); // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps }, []); @@ -110,7 +114,7 @@ function RoomMembersPage({report, session, policies}: RoomMembersPageProps) { } setSearchValue(''); Navigation.navigate(ROUTES.ROOM_INVITE.getRoute(report.reportID)); - }, [report]); + }, [report, setSearchValue]); /** * Remove selected users from the room @@ -121,7 +125,7 @@ function RoomMembersPage({report, session, policies}: RoomMembersPageProps) { Report.removeFromRoom(report.reportID, selectedMembers); } setSearchValue(''); - SearchInputManager.searchInput = ''; + UserSearchPhraseActions.clearUserSearchPhrase(); setSelectedMembers([]); setRemoveMembersConfirmModalVisible(false); }; @@ -196,12 +200,12 @@ function RoomMembersPage({report, session, policies}: RoomMembersPageProps) { return; } if (shouldShowTextInput) { - setSearchValue(SearchInputManager.searchInput); + setSearchValue(userSearchPhrase ?? ''); } else { - SearchInputManager.searchInput = ''; + UserSearchPhraseActions.clearUserSearchPhrase(); setSearchValue(''); } - }, [isFocusedScreen, shouldShowTextInput]); + }, [isFocusedScreen, setSearchValue, shouldShowTextInput, userSearchPhrase]); const data = useMemo((): ListItem[] => { let result: ListItem[] = []; @@ -378,7 +382,6 @@ function RoomMembersPage({report, session, policies}: RoomMembersPageProps) { disableKeyboardShortcuts={removeMembersConfirmModalVisible} textInputValue={searchValue} onChangeText={(value) => { - SearchInputManager.searchInput = value; setSearchValue(value); }} headerMessage={headerMessage} diff --git a/src/pages/workspace/SearchInputManager.ts b/src/pages/workspace/SearchInputManager.ts deleted file mode 100644 index 599f7cca6cf9..000000000000 --- a/src/pages/workspace/SearchInputManager.ts +++ /dev/null @@ -1,5 +0,0 @@ -// eslint-disable-next-line prefer-const -let searchInput = ''; -export default { - searchInput, -}; diff --git a/src/pages/workspace/WorkspaceInviteMessagePage.tsx b/src/pages/workspace/WorkspaceInviteMessagePage.tsx index df34875f5fa6..ff5b7326af84 100644 --- a/src/pages/workspace/WorkspaceInviteMessagePage.tsx +++ b/src/pages/workspace/WorkspaceInviteMessagePage.tsx @@ -38,7 +38,6 @@ import INPUT_IDS from '@src/types/form/WorkspaceInviteMessageForm'; import type {InvitedEmailsToAccountIDs, PersonalDetailsList} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import AccessOrNotFoundWrapper from './AccessOrNotFoundWrapper'; -import SearchInputManager from './SearchInputManager'; import withPolicyAndFullscreenLoading from './withPolicyAndFullscreenLoading'; import type {WithPolicyAndFullscreenLoadingProps} from './withPolicyAndFullscreenLoading'; @@ -110,7 +109,6 @@ function WorkspaceInviteMessagePage({ // Please see https://github.com/Expensify/App/blob/main/README.md#Security for more details Member.addMembersToWorkspace(invitedEmailsToAccountIDsDraft ?? {}, `${welcomeNoteSubject}\n\n${welcomeNote}`, route.params.policyID); debouncedSaveDraft(null); - SearchInputManager.searchInput = ''; Navigation.dismissModal(); }; diff --git a/src/pages/workspace/WorkspaceInvitePage.tsx b/src/pages/workspace/WorkspaceInvitePage.tsx index c29819b3c6f9..ad48d15aa9df 100644 --- a/src/pages/workspace/WorkspaceInvitePage.tsx +++ b/src/pages/workspace/WorkspaceInvitePage.tsx @@ -38,7 +38,6 @@ import type {Beta, InvitedEmailsToAccountIDs} from '@src/types/onyx'; import type {Errors} from '@src/types/onyx/OnyxCommon'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import AccessOrNotFoundWrapper from './AccessOrNotFoundWrapper'; -import SearchInputManager from './SearchInputManager'; import withPolicyAndFullscreenLoading from './withPolicyAndFullscreenLoading'; import type {WithPolicyAndFullscreenLoadingProps} from './withPolicyAndFullscreenLoading'; @@ -77,7 +76,6 @@ function WorkspaceInvitePage({route, betas, invitedEmailsToAccountIDsDraft, poli }); useEffect(() => { - setSearchTerm(SearchInputManager.searchInput); return () => { Member.setWorkspaceInviteMembersDraft(route.params.policyID, {}); }; @@ -338,7 +336,6 @@ function WorkspaceInvitePage({route, betas, invitedEmailsToAccountIDsDraft, poli textInputLabel={translate('selectionList.nameEmailOrPhoneNumber')} textInputValue={searchTerm} onChangeText={(value) => { - SearchInputManager.searchInput = value; setSearchTerm(value); }} headerMessage={headerMessage}