From 0997e2fecbfb2b52a8780cc09101d8db08cff5b1 Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Sun, 22 Feb 2026 14:36:25 +0430 Subject: [PATCH 01/13] fix: align device and in-app back navigation behavior in Paid filter --- src/CONST/index.ts | 3 + src/ROUTES.ts | 10 ++- .../FilterComponents/DateFilterBase.tsx | 22 +++++-- .../Search/SearchDatePresetFilterBasePage.tsx | 61 +++++++++++++++++-- src/libs/Navigation/linkingConfig/config.ts | 14 ++--- src/pages/Search/AdvancedSearchFilters.tsx | 14 ++--- 6 files changed, 98 insertions(+), 26 deletions(-) diff --git a/src/CONST/index.ts b/src/CONST/index.ts index e8d303b1b8e18..9d78d02fb3cf8 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -7587,6 +7587,9 @@ const CONST = { AFTER: 'After', BEFORE: 'Before', }, + DATE_FILTER_SUB_PAGE: { + MAIN: 'main', + }, AMOUNT_MODIFIERS: { LESS_THAN: 'LessThan', GREATER_THAN: 'GreaterThan', diff --git a/src/ROUTES.ts b/src/ROUTES.ts index afa59492cd285..2d770a2c8ec5b 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -108,9 +108,13 @@ const ROUTES = { }, SEARCH_COLUMNS: 'search/columns', SEARCH_ADVANCED_FILTERS: { - route: 'search/filters/:filterKey?', - getRoute: (filterKey?: SearchFilterKey | UserFriendlyKey) => { - return `search/filters/${filterKey ?? ''}` as const; + route: 'search/filters/:filterKey?/:subPage?', + getRoute: (filterKey?: SearchFilterKey | UserFriendlyKey, subPage?: string) => { + const baseRoute = `search/filters/${filterKey ?? ''}` as const; + if (!subPage || !filterKey) { + return baseRoute; + } + return `${baseRoute}/${encodeURIComponent(subPage)}` as const; }, }, SEARCH_REPORT: { diff --git a/src/components/Search/FilterComponents/DateFilterBase.tsx b/src/components/Search/FilterComponents/DateFilterBase.tsx index 5f7545e0eb214..aabf3ba0d6e6a 100644 --- a/src/components/Search/FilterComponents/DateFilterBase.tsx +++ b/src/components/Search/FilterComponents/DateFilterBase.tsx @@ -20,16 +20,30 @@ type DateFilterBaseProps = { dateKey: SearchDateFilterKeys; back: () => void; onSubmit: (values: Record) => void; + selectedDateModifier?: SearchDateModifier | null; + onSelectDateModifier?: (dateModifier: SearchDateModifier | null) => void; }; -function DateFilterBase({title, dateKey, back, onSubmit}: DateFilterBaseProps) { +function DateFilterBase({title, dateKey, back, onSubmit, selectedDateModifier: selectedDateModifierProp, onSelectDateModifier}: DateFilterBaseProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); const searchDatePresetFilterBaseRef = useRef(null); const [searchAdvancedFiltersForm, searchAdvancedFiltersFormMetadata] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true}); const isSearchAdvancedFiltersFormLoading = isLoadingOnyxValue(searchAdvancedFiltersFormMetadata); - const [selectedDateModifier, setSelectedDateModifier] = useState(null); + const [selectedDateModifierState, setSelectedDateModifierState] = useState(null); + const isDateModifierControlled = selectedDateModifierProp !== undefined; + const selectedDateModifier = isDateModifierControlled ? selectedDateModifierProp : selectedDateModifierState; + const setSelectedDateModifier = useCallback( + (dateModifier: SearchDateModifier | null) => { + if (isDateModifierControlled) { + onSelectDateModifier?.(dateModifier); + return; + } + setSelectedDateModifierState(dateModifier); + }, + [isDateModifierControlled, onSelectDateModifier], + ); const dateOnKey = dateKey.startsWith(CONST.SEARCH.REPORT_FIELD.GLOBAL_PREFIX) ? (dateKey.replace(CONST.SEARCH.REPORT_FIELD.DEFAULT_PREFIX, CONST.SEARCH.REPORT_FIELD.ON_PREFIX) as ReportFieldDateKey) @@ -81,7 +95,7 @@ function DateFilterBase({title, dateKey, back, onSubmit}: DateFilterBaseProps) { } searchDatePresetFilterBaseRef.current.clearDateValues(); - }, [selectedDateModifier]); + }, [selectedDateModifier, setSelectedDateModifier]); const save = useCallback(() => { if (!searchDatePresetFilterBaseRef.current) { @@ -101,7 +115,7 @@ function DateFilterBase({title, dateKey, back, onSubmit}: DateFilterBaseProps) { [dateBeforeKey]: dateValues[CONST.SEARCH.DATE_MODIFIERS.BEFORE] ?? null, [dateAfterKey]: dateValues[CONST.SEARCH.DATE_MODIFIERS.AFTER] ?? null, }); - }, [selectedDateModifier, dateOnKey, dateBeforeKey, dateAfterKey, onSubmit]); + }, [selectedDateModifier, dateOnKey, dateBeforeKey, dateAfterKey, onSubmit, setSelectedDateModifier]); const goBack = () => { if (selectedDateModifier) { diff --git a/src/components/Search/SearchDatePresetFilterBasePage.tsx b/src/components/Search/SearchDatePresetFilterBasePage.tsx index 7e735321b500b..e04c6f88e8feb 100644 --- a/src/components/Search/SearchDatePresetFilterBasePage.tsx +++ b/src/components/Search/SearchDatePresetFilterBasePage.tsx @@ -1,17 +1,33 @@ -import React from 'react'; +import React, {useCallback, useMemo} from 'react'; +import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; +import useSubPage from '@hooks/useSubPage'; +import type {PageConfig, SubPageProps} from '@hooks/useSubPage/types'; import useThemeStyles from '@hooks/useThemeStyles'; import {updateAdvancedFilters} from '@libs/actions/Search'; import Navigation from '@libs/Navigation/Navigation'; +import type {SearchDateModifier} from '@libs/SearchUIUtils'; +import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; import ROUTES from '@src/ROUTES'; import DateFilterBase from './FilterComponents/DateFilterBase'; -import type {SearchDateFilterKeys} from './types'; +import type {SearchDateFilterKeys, SearchFilterKey} from './types'; + +function EmptySubPageComponent() { + return null; +} + +const DATE_FILTER_SUB_PAGES: Array> = [ + {pageName: CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN, component: EmptySubPageComponent}, + {pageName: CONST.SEARCH.DATE_MODIFIERS.ON, component: EmptySubPageComponent}, + {pageName: CONST.SEARCH.DATE_MODIFIERS.AFTER, component: EmptySubPageComponent}, + {pageName: CONST.SEARCH.DATE_MODIFIERS.BEFORE, component: EmptySubPageComponent}, +]; type SearchDatePresetFilterBasePageProps = { /** Key used for the date filter */ - dateKey: SearchDateFilterKeys; + dateKey: Extract; /** The translation key for the page title */ titleKey: TranslationPaths; @@ -21,9 +37,42 @@ function SearchDatePresetFilterBasePage({dateKey, titleKey}: SearchDatePresetFil const styles = useThemeStyles(); const {translate} = useLocalize(); - const goBack = () => { + const goBack = useCallback(() => { Navigation.goBack(ROUTES.SEARCH_ADVANCED_FILTERS.getRoute()); - }; + }, []); + + const buildSubPageRoute = useCallback((subPage: string) => ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(dateKey, subPage), [dateKey]); + + const {currentPageName, resetToPage, isRedirecting} = useSubPage({ + pages: DATE_FILTER_SUB_PAGES, + startFrom: 0, + onFinished: goBack, + buildRoute: buildSubPageRoute, + }); + + const selectedDateModifier = useMemo(() => { + if (currentPageName === CONST.SEARCH.DATE_MODIFIERS.ON || currentPageName === CONST.SEARCH.DATE_MODIFIERS.AFTER || currentPageName === CONST.SEARCH.DATE_MODIFIERS.BEFORE) { + return currentPageName; + } + + return null; + }, [currentPageName]); + + const selectDateModifier = useCallback( + (dateModifier: SearchDateModifier | null) => { + if (!dateModifier) { + Navigation.goBack(buildSubPageRoute(CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN)); + return; + } + + resetToPage(dateModifier); + }, + [buildSubPageRoute, resetToPage], + ); + + if (isRedirecting) { + return ; + } return ( { updateAdvancedFilters(values); Navigation.goBack(ROUTES.SEARCH_ADVANCED_FILTERS.getRoute()); diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index 236214e627ae7..249e82306bf07 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -1871,13 +1871,13 @@ const config: LinkingOptions['config'] = { [SCREENS.SEARCH.ADVANCED_FILTERS_GROUP_BY_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.GROUP_BY), [SCREENS.SEARCH.ADVANCED_FILTERS_VIEW_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.VIEW), [SCREENS.SEARCH.ADVANCED_FILTERS_STATUS_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.STATUS), - [SCREENS.SEARCH.ADVANCED_FILTERS_DATE_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE), - [SCREENS.SEARCH.ADVANCED_FILTERS_SUBMITTED_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.SUBMITTED), - [SCREENS.SEARCH.ADVANCED_FILTERS_APPROVED_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.APPROVED), - [SCREENS.SEARCH.ADVANCED_FILTERS_PAID_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.PAID), - [SCREENS.SEARCH.ADVANCED_FILTERS_EXPORTED_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED), - [SCREENS.SEARCH.ADVANCED_FILTERS_POSTED_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.POSTED), - [SCREENS.SEARCH.ADVANCED_FILTERS_WITHDRAWN_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWN), + [SCREENS.SEARCH.ADVANCED_FILTERS_DATE_RHP]: `${ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE)}/:subPage?`, + [SCREENS.SEARCH.ADVANCED_FILTERS_SUBMITTED_RHP]: `${ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.SUBMITTED)}/:subPage?`, + [SCREENS.SEARCH.ADVANCED_FILTERS_APPROVED_RHP]: `${ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.APPROVED)}/:subPage?`, + [SCREENS.SEARCH.ADVANCED_FILTERS_PAID_RHP]: `${ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.PAID)}/:subPage?`, + [SCREENS.SEARCH.ADVANCED_FILTERS_EXPORTED_RHP]: `${ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED)}/:subPage?`, + [SCREENS.SEARCH.ADVANCED_FILTERS_POSTED_RHP]: `${ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.POSTED)}/:subPage?`, + [SCREENS.SEARCH.ADVANCED_FILTERS_WITHDRAWN_RHP]: `${ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWN)}/:subPage?`, [SCREENS.SEARCH.ADVANCED_FILTERS_CURRENCY_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.CURRENCY), [SCREENS.SEARCH.ADVANCED_FILTERS_GROUP_CURRENCY_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.GROUP_CURRENCY), [SCREENS.SEARCH.ADVANCED_FILTERS_MERCHANT_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.MERCHANT), diff --git a/src/pages/Search/AdvancedSearchFilters.tsx b/src/pages/Search/AdvancedSearchFilters.tsx index 109e1d2c021b4..1c27f060944b6 100644 --- a/src/pages/Search/AdvancedSearchFilters.tsx +++ b/src/pages/Search/AdvancedSearchFilters.tsx @@ -82,37 +82,37 @@ const baseFilterConfig = { date: { getTitle: getFilterDisplayTitle, description: 'common.date' as const, - route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE), + route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE, CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN), }, submitted: { getTitle: getFilterDisplayTitle, description: 'search.filters.submitted' as const, - route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.SUBMITTED), + route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.SUBMITTED, CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN), }, approved: { getTitle: getFilterDisplayTitle, description: 'search.filters.approved' as const, - route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.APPROVED), + route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.APPROVED, CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN), }, paid: { getTitle: getFilterDisplayTitle, description: 'search.filters.paid' as const, - route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.PAID), + route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.PAID, CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN), }, exported: { getTitle: getFilterDisplayTitle, description: 'search.filters.exported' as const, - route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED), + route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED, CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN), }, posted: { getTitle: getFilterDisplayTitle, description: 'search.filters.posted' as const, - route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.POSTED), + route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.POSTED, CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN), }, withdrawn: { getTitle: getFilterDisplayTitle, description: 'search.filters.withdrawn' as const, - route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWN), + route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWN, CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN), }, currency: { getTitle: getFilterDisplayTitle, From 088e7308810b16383bbe8313ac49bf31d59adb36 Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Wed, 4 Mar 2026 15:13:22 +0430 Subject: [PATCH 02/13] fixed typecheck --- src/pages/settings/VerifyAccountPageBase.tsx | 25 +++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/pages/settings/VerifyAccountPageBase.tsx b/src/pages/settings/VerifyAccountPageBase.tsx index f733a5b13ea43..4d6a9944d21f8 100644 --- a/src/pages/settings/VerifyAccountPageBase.tsx +++ b/src/pages/settings/VerifyAccountPageBase.tsx @@ -56,19 +56,22 @@ function VerifyAccountPageBase({navigateBackTo, navigateForwardTo, handleClose, }, [handleClose, navigateBackTo]); // Handle navigation once the user is validated - useEffect(() => { - if (!isUserValidated) { - return; - } + useEffect( + () => { + if (!isUserValidated) { + return; + } - onValidationSuccess?.(); + onValidationSuccess?.(); - if (navigateForwardTo) { - Navigation.navigate(navigateForwardTo, {forceReplace: true}); - } else { - handleCloseWithFallback(); - } - }, [isUserValidated, navigateForwardTo, handleCloseWithFallback, handleClose, onValidationSuccess]); + if (navigateForwardTo) { + Navigation.navigate(navigateForwardTo, {forceReplace: true}); + } else { + handleCloseWithFallback(); + } + }, + [isUserValidated, navigateForwardTo, handleCloseWithFallback, onValidationSuccess] as React.DependencyList, + ); // Once user is validated or the modal is dismissed, we don't want to show empty content. if (isUserValidated) { From 7e6797b8d896d7ba74d122aa12fa1670c5dae448 Mon Sep 17 00:00:00 2001 From: marufsharifi Date: Thu, 5 Mar 2026 12:26:04 +0430 Subject: [PATCH 03/13] fixed typecheck --- src/libs/Navigation/linkingConfig/config.ts | 8 -------- .../settings/Profile/Contacts/ContactMethodsPage.tsx | 2 +- src/pages/settings/VerifyAccountPageBase.tsx | 7 ++++--- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index 738188728de84..d5ace52a0a444 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -2111,14 +2111,6 @@ const config: LinkingOptions['config'] = { }, [SCREENS.REPORT]: { path: ROUTES.REPORT_WITH_ID.route, - // If params are defined, but reportID is explicitly undefined, we will get the url /r/undefined. - // We want to avoid that situation, so we will return an empty string instead. - parse: { - reportID: (reportID: string | undefined) => reportID ?? '', - }, - stringify: { - reportID: (reportID: string | undefined) => reportID ?? '', - }, }, }, }, diff --git a/src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx b/src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx index 43feb1062dc88..2568377892906 100644 --- a/src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx +++ b/src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx @@ -30,7 +30,7 @@ function ContactMethodsPage({route}: ContactMethodsPageProps) { const {translate} = useLocalize(); const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST); const [session] = useOnyx(ONYXKEYS.SESSION); - const navigateBackTo = route?.params?.backTo; + const navigateBackTo: string | undefined = route?.params?.backTo; const {isActingAsDelegate} = useDelegateNoAccessState(); const {showDelegateNoAccessModal} = useDelegateNoAccessActions(); diff --git a/src/pages/settings/VerifyAccountPageBase.tsx b/src/pages/settings/VerifyAccountPageBase.tsx index 4d6a9944d21f8..9ce4271b67650 100644 --- a/src/pages/settings/VerifyAccountPageBase.tsx +++ b/src/pages/settings/VerifyAccountPageBase.tsx @@ -29,6 +29,7 @@ function VerifyAccountPageBase({navigateBackTo, navigateForwardTo, handleClose, const styles = useThemeStyles(); const [account] = useOnyx(ONYXKEYS.ACCOUNT); const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST); + const navigateForwardToPath: string | undefined = navigateForwardTo; const currentUserPersonalDetails = useCurrentUserPersonalDetails(); // sometimes primaryLogin can be empty string // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing @@ -64,13 +65,13 @@ function VerifyAccountPageBase({navigateBackTo, navigateForwardTo, handleClose, onValidationSuccess?.(); - if (navigateForwardTo) { - Navigation.navigate(navigateForwardTo, {forceReplace: true}); + if (navigateForwardToPath) { + Navigation.navigate(navigateForwardToPath as Route, {forceReplace: true}); } else { handleCloseWithFallback(); } }, - [isUserValidated, navigateForwardTo, handleCloseWithFallback, onValidationSuccess] as React.DependencyList, + [isUserValidated, navigateForwardToPath, handleCloseWithFallback, onValidationSuccess] as React.DependencyList, ); // Once user is validated or the modal is dismissed, we don't want to show empty content. From 5b17f96d1ebfa0faa8d45637f158f95d8785f36d Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Sat, 7 Mar 2026 14:46:13 +0430 Subject: [PATCH 04/13] fixed type failure --- src/pages/LogOutPreviousUserPage.tsx | 9 +++++---- src/pages/PrivateNotes/PrivateNotesListPage.tsx | 4 ++-- src/pages/ReportDetailsPage.tsx | 8 ++++---- src/pages/domain/BaseDomainVerifiedPage.tsx | 5 +++-- src/pages/domain/BaseVerifyDomainPage.tsx | 5 +++-- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/pages/LogOutPreviousUserPage.tsx b/src/pages/LogOutPreviousUserPage.tsx index e975f7a17b5f1..e8cfbb837a982 100644 --- a/src/pages/LogOutPreviousUserPage.tsx +++ b/src/pages/LogOutPreviousUserPage.tsx @@ -26,6 +26,7 @@ function LogOutPreviousUserPage({route}: LogOutPreviousUserPageProps) { const [account] = useOnyx(ONYXKEYS.ACCOUNT); const isAccountLoading = account?.isLoading; const {authTokenType, shortLivedAuthToken = '', exitTo} = route?.params ?? {}; + const exitToPath: string | undefined = exitTo; useEffect(() => { const sessionEmail = session?.email; @@ -65,17 +66,17 @@ function LogOutPreviousUserPage({route}: LogOutPreviousUserPageProps) { // because we already handle creating the optimistic policy and navigating to it in App.setUpPoliciesAndNavigate, // which is already called when AuthScreens mounts. // For HybridApp we have separate logic to handle transitions. - if (!CONFIG.IS_HYBRID_APP && exitTo !== ROUTES.WORKSPACE_NEW && !isAccountLoading && !isLoggingInAsNewUser) { + if (!CONFIG.IS_HYBRID_APP && exitToPath !== ROUTES.WORKSPACE_NEW && !isAccountLoading && !isLoggingInAsNewUser) { Navigation.isNavigationReady().then(() => { // remove this screen and navigate to exit route Navigation.goBack(); - if (exitTo) { - Navigation.navigate(exitTo as Route); + if (exitToPath) { + Navigation.navigate(exitToPath as Route); } }); } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [initialURL, isAccountLoading]); + }, [initialURL, isAccountLoading, exitToPath] as React.DependencyList); return ; } diff --git a/src/pages/PrivateNotes/PrivateNotesListPage.tsx b/src/pages/PrivateNotes/PrivateNotesListPage.tsx index 69609d602f159..dfb152469c9d2 100644 --- a/src/pages/PrivateNotes/PrivateNotesListPage.tsx +++ b/src/pages/PrivateNotes/PrivateNotesListPage.tsx @@ -39,7 +39,7 @@ type NoteListItem = { function PrivateNotesListPage({report, accountID: sessionAccountID}: PrivateNotesListPageProps) { const route = useRoute>(); - const backTo = route.params.backTo; + const backTo: string | undefined = route.params.backTo; const [personalDetailsList] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); const styles = useThemeStyles(); const {translate} = useLocalize(); @@ -85,7 +85,7 @@ function PrivateNotesListPage({report, accountID: sessionAccountID}: PrivateNote disabled: Number(sessionAccountID) !== accountID, }; }); - }, [report, personalDetailsList, sessionAccountID, translate, backTo]); + }, [report, personalDetailsList, sessionAccountID, translate, backTo] as React.DependencyList); return ( diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index 3fb71e76728cc..1fd6d32eaf5c9 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -162,7 +162,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail const activePolicy = useActivePolicy(); const styles = useThemeStyles(); const expensifyIcons = useMemoizedLazyExpensifyIcons(['Users', 'Gear', 'Send', 'Folder', 'UserPlus', 'Pencil', 'Checkmark', 'Building', 'Exit', 'Bug', 'Camera', 'Trashcan']); - const backTo = route.params.backTo; + const backTo: string | undefined = route.params.backTo; const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED); @@ -533,7 +533,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail translationKey: 'task.markAsIncomplete', isAnonymousAction: false, action: callFunctionIfActionIsAllowed(() => { - Navigation.goBack(backTo); + Navigation.goBack(backTo as Route | undefined); reopenTask(report, parentReport, currentUserPersonalDetails?.accountID); }), }); @@ -739,7 +739,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail result.push(PromotedActions.share(report, backTo)); return result; - }, [canJoin, report, backTo, currentUserPersonalDetails.accountID]); + }, [canJoin, report, backTo, currentUserPersonalDetails.accountID] as React.DependencyList); const nameSectionExpenseIOU = ( @@ -1033,7 +1033,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail Navigation.goBack(backTo)} + onBackButtonPress={() => Navigation.goBack(backTo as Route | undefined)} /> diff --git a/src/pages/domain/BaseDomainVerifiedPage.tsx b/src/pages/domain/BaseDomainVerifiedPage.tsx index d5ddbb8288cd5..2a4bc8e3cd42b 100644 --- a/src/pages/domain/BaseDomainVerifiedPage.tsx +++ b/src/pages/domain/BaseDomainVerifiedPage.tsx @@ -28,6 +28,7 @@ type BaseDomainVerifiedPageProps = { function BaseDomainVerifiedPage({domainAccountID, redirectTo}: BaseDomainVerifiedPageProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); + const redirectToPath: string = redirectTo; const [domain, domainMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN}${domainAccountID}`); const [isAdmin, isAdminMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_ADMIN_ACCESS}${domainAccountID}`); @@ -37,8 +38,8 @@ function BaseDomainVerifiedPage({domainAccountID, redirectTo}: BaseDomainVerifie if (!doesDomainExist || domain?.validated) { return; } - Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.navigate(redirectTo, {forceReplace: true})); - }, [domainAccountID, domain?.validated, doesDomainExist, redirectTo]); + Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.navigate(redirectToPath as Route, {forceReplace: true})); + }, [domain?.validated, doesDomainExist, redirectToPath] as React.DependencyList); if (isLoadingOnyxValue(domainMetadata, isAdminMetadata)) { return ; diff --git a/src/pages/domain/BaseVerifyDomainPage.tsx b/src/pages/domain/BaseVerifyDomainPage.tsx index b2a3d40fdf8df..6acaa3d794741 100644 --- a/src/pages/domain/BaseVerifyDomainPage.tsx +++ b/src/pages/domain/BaseVerifyDomainPage.tsx @@ -48,6 +48,7 @@ function BaseVerifyDomainPage({domainAccountID, forwardTo}: BaseVerifyDomainPage const styles = useThemeStyles(); const theme = useTheme(); const {translate} = useLocalize(); + const forwardToPath: string = forwardTo; const [domain, domainMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN}${domainAccountID}`); const domainName = domain ? Str.extractEmailDomain(domain.email) : ''; @@ -59,8 +60,8 @@ function BaseVerifyDomainPage({domainAccountID, forwardTo}: BaseVerifyDomainPage if (!domain?.hasValidationSucceeded) { return; } - Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.navigate(forwardTo, {forceReplace: true})); - }, [domainAccountID, domain?.hasValidationSucceeded, forwardTo]); + Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.navigate(forwardToPath as Route, {forceReplace: true})); + }, [domain?.hasValidationSucceeded, forwardToPath] as React.DependencyList); useEffect(() => { if (!doesDomainExist) { From 931dd34e80556856ba79f59fdfcd9af5d502423a Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Sat, 7 Mar 2026 14:48:08 +0430 Subject: [PATCH 05/13] fixed prettier --- src/pages/LogOutPreviousUserPage.tsx | 41 ++++++++++--------- .../PrivateNotes/PrivateNotesListPage.tsx | 35 ++++++++-------- src/pages/ReportDetailsPage.tsx | 25 ++++++----- src/pages/domain/BaseDomainVerifiedPage.tsx | 15 ++++--- src/pages/domain/BaseVerifyDomainPage.tsx | 15 ++++--- 5 files changed, 73 insertions(+), 58 deletions(-) diff --git a/src/pages/LogOutPreviousUserPage.tsx b/src/pages/LogOutPreviousUserPage.tsx index e8cfbb837a982..611fc78088b01 100644 --- a/src/pages/LogOutPreviousUserPage.tsx +++ b/src/pages/LogOutPreviousUserPage.tsx @@ -58,25 +58,28 @@ function LogOutPreviousUserPage({route}: LogOutPreviousUserPageProps) { // eslint-disable-next-line react-hooks/exhaustive-deps }, [initialURL]); - useEffect(() => { - const sessionEmail = session?.email; - const transitionURL = CONFIG.IS_HYBRID_APP ? `${CONST.DEEPLINK_BASE_URL}${initialURL ?? ''}` : initialURL; - const isLoggingInAsNewUser = isLoggingInAsNewUserSessionUtils(transitionURL ?? undefined, sessionEmail); - // We don't want to navigate to the exitTo route when creating a new workspace from a deep link, - // because we already handle creating the optimistic policy and navigating to it in App.setUpPoliciesAndNavigate, - // which is already called when AuthScreens mounts. - // For HybridApp we have separate logic to handle transitions. - if (!CONFIG.IS_HYBRID_APP && exitToPath !== ROUTES.WORKSPACE_NEW && !isAccountLoading && !isLoggingInAsNewUser) { - Navigation.isNavigationReady().then(() => { - // remove this screen and navigate to exit route - Navigation.goBack(); - if (exitToPath) { - Navigation.navigate(exitToPath as Route); - } - }); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [initialURL, isAccountLoading, exitToPath] as React.DependencyList); + useEffect( + () => { + const sessionEmail = session?.email; + const transitionURL = CONFIG.IS_HYBRID_APP ? `${CONST.DEEPLINK_BASE_URL}${initialURL ?? ''}` : initialURL; + const isLoggingInAsNewUser = isLoggingInAsNewUserSessionUtils(transitionURL ?? undefined, sessionEmail); + // We don't want to navigate to the exitTo route when creating a new workspace from a deep link, + // because we already handle creating the optimistic policy and navigating to it in App.setUpPoliciesAndNavigate, + // which is already called when AuthScreens mounts. + // For HybridApp we have separate logic to handle transitions. + if (!CONFIG.IS_HYBRID_APP && exitToPath !== ROUTES.WORKSPACE_NEW && !isAccountLoading && !isLoggingInAsNewUser) { + Navigation.isNavigationReady().then(() => { + // remove this screen and navigate to exit route + Navigation.goBack(); + if (exitToPath) { + Navigation.navigate(exitToPath as Route); + } + }); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, + [initialURL, isAccountLoading, exitToPath] as React.DependencyList, + ); return ; } diff --git a/src/pages/PrivateNotes/PrivateNotesListPage.tsx b/src/pages/PrivateNotes/PrivateNotesListPage.tsx index dfb152469c9d2..ee4d0c8688dea 100644 --- a/src/pages/PrivateNotes/PrivateNotesListPage.tsx +++ b/src/pages/PrivateNotes/PrivateNotesListPage.tsx @@ -70,22 +70,25 @@ function PrivateNotesListPage({report, accountID: sessionAccountID}: PrivateNote /** * Returns a list of private notes on the given chat report */ - const privateNotes = useMemo(() => { - const privateNoteBrickRoadIndicator = (accountID: number) => (report.privateNotes?.[accountID].errors ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined); - return Object.keys(report.privateNotes ?? {}).map((privateNoteAccountID: string) => { - const accountID = Number(privateNoteAccountID); - const privateNote = report.privateNotes?.[accountID]; - return { - reportID: report.reportID, - accountID: privateNoteAccountID, - title: Number(sessionAccountID) === accountID ? translate('privateNotes.myNote') : (personalDetailsList?.[privateNoteAccountID]?.login ?? ''), - action: () => Navigation.navigate(ROUTES.PRIVATE_NOTES_EDIT.getRoute(report.reportID, accountID, backTo)), - brickRoadIndicator: privateNoteBrickRoadIndicator(accountID), - note: privateNote?.note ?? '', - disabled: Number(sessionAccountID) !== accountID, - }; - }); - }, [report, personalDetailsList, sessionAccountID, translate, backTo] as React.DependencyList); + const privateNotes = useMemo( + () => { + const privateNoteBrickRoadIndicator = (accountID: number) => (report.privateNotes?.[accountID].errors ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined); + return Object.keys(report.privateNotes ?? {}).map((privateNoteAccountID: string) => { + const accountID = Number(privateNoteAccountID); + const privateNote = report.privateNotes?.[accountID]; + return { + reportID: report.reportID, + accountID: privateNoteAccountID, + title: Number(sessionAccountID) === accountID ? translate('privateNotes.myNote') : (personalDetailsList?.[privateNoteAccountID]?.login ?? ''), + action: () => Navigation.navigate(ROUTES.PRIVATE_NOTES_EDIT.getRoute(report.reportID, accountID, backTo)), + brickRoadIndicator: privateNoteBrickRoadIndicator(accountID), + note: privateNote?.note ?? '', + disabled: Number(sessionAccountID) !== accountID, + }; + }); + }, + [report, personalDetailsList, sessionAccountID, translate, backTo] as React.DependencyList, + ); return ( diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index 1fd6d32eaf5c9..da3d7d150f98e 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -725,21 +725,24 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail const canJoin = canJoinChat(report, parentReportAction, policy, parentReport, !!reportNameValuePairs?.private_isArchived); - const promotedActions = useMemo(() => { - const result: PromotedAction[] = []; + const promotedActions = useMemo( + () => { + const result: PromotedAction[] = []; - if (canJoin) { - result.push(PromotedActions.join(report, currentUserPersonalDetails.accountID)); - } + if (canJoin) { + result.push(PromotedActions.join(report, currentUserPersonalDetails.accountID)); + } - if (report) { - result.push(PromotedActions.pin(report)); - } + if (report) { + result.push(PromotedActions.pin(report)); + } - result.push(PromotedActions.share(report, backTo)); + result.push(PromotedActions.share(report, backTo)); - return result; - }, [canJoin, report, backTo, currentUserPersonalDetails.accountID] as React.DependencyList); + return result; + }, + [canJoin, report, backTo, currentUserPersonalDetails.accountID] as React.DependencyList, + ); const nameSectionExpenseIOU = ( diff --git a/src/pages/domain/BaseDomainVerifiedPage.tsx b/src/pages/domain/BaseDomainVerifiedPage.tsx index 2a4bc8e3cd42b..e3a0c414897bd 100644 --- a/src/pages/domain/BaseDomainVerifiedPage.tsx +++ b/src/pages/domain/BaseDomainVerifiedPage.tsx @@ -34,12 +34,15 @@ function BaseDomainVerifiedPage({domainAccountID, redirectTo}: BaseDomainVerifie const [isAdmin, isAdminMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_ADMIN_ACCESS}${domainAccountID}`); const doesDomainExist = !!domain; - useEffect(() => { - if (!doesDomainExist || domain?.validated) { - return; - } - Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.navigate(redirectToPath as Route, {forceReplace: true})); - }, [domain?.validated, doesDomainExist, redirectToPath] as React.DependencyList); + useEffect( + () => { + if (!doesDomainExist || domain?.validated) { + return; + } + Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.navigate(redirectToPath as Route, {forceReplace: true})); + }, + [domain?.validated, doesDomainExist, redirectToPath] as React.DependencyList, + ); if (isLoadingOnyxValue(domainMetadata, isAdminMetadata)) { return ; diff --git a/src/pages/domain/BaseVerifyDomainPage.tsx b/src/pages/domain/BaseVerifyDomainPage.tsx index 6acaa3d794741..641a130ca0906 100644 --- a/src/pages/domain/BaseVerifyDomainPage.tsx +++ b/src/pages/domain/BaseVerifyDomainPage.tsx @@ -56,12 +56,15 @@ function BaseVerifyDomainPage({domainAccountID, forwardTo}: BaseVerifyDomainPage const {asset: Exclamation} = useMemoizedLazyAsset(() => loadExpensifyIcon('Exclamation')); - useEffect(() => { - if (!domain?.hasValidationSucceeded) { - return; - } - Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.navigate(forwardToPath as Route, {forceReplace: true})); - }, [domain?.hasValidationSucceeded, forwardToPath] as React.DependencyList); + useEffect( + () => { + if (!domain?.hasValidationSucceeded) { + return; + } + Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.navigate(forwardToPath as Route, {forceReplace: true})); + }, + [domain?.hasValidationSucceeded, forwardToPath] as React.DependencyList, + ); useEffect(() => { if (!doesDomainExist) { From 4ee714177fce63af094238ae3f20f3409a995130 Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Tue, 10 Mar 2026 17:31:58 +0430 Subject: [PATCH 06/13] reverted unwanted changes --- src/pages/LogOutPreviousUserPage.tsx | 42 +++++++++---------- .../PrivateNotes/PrivateNotesListPage.tsx | 37 ++++++++-------- src/pages/ReportDetailsPage.tsx | 8 ++-- src/pages/domain/BaseVerifyDomainPage.tsx | 16 +++---- .../Profile/Contacts/ContactMethodsPage.tsx | 2 +- src/pages/settings/VerifyAccountPageBase.tsx | 8 ++-- 6 files changed, 50 insertions(+), 63 deletions(-) diff --git a/src/pages/LogOutPreviousUserPage.tsx b/src/pages/LogOutPreviousUserPage.tsx index 611fc78088b01..e975f7a17b5f1 100644 --- a/src/pages/LogOutPreviousUserPage.tsx +++ b/src/pages/LogOutPreviousUserPage.tsx @@ -26,7 +26,6 @@ function LogOutPreviousUserPage({route}: LogOutPreviousUserPageProps) { const [account] = useOnyx(ONYXKEYS.ACCOUNT); const isAccountLoading = account?.isLoading; const {authTokenType, shortLivedAuthToken = '', exitTo} = route?.params ?? {}; - const exitToPath: string | undefined = exitTo; useEffect(() => { const sessionEmail = session?.email; @@ -58,28 +57,25 @@ function LogOutPreviousUserPage({route}: LogOutPreviousUserPageProps) { // eslint-disable-next-line react-hooks/exhaustive-deps }, [initialURL]); - useEffect( - () => { - const sessionEmail = session?.email; - const transitionURL = CONFIG.IS_HYBRID_APP ? `${CONST.DEEPLINK_BASE_URL}${initialURL ?? ''}` : initialURL; - const isLoggingInAsNewUser = isLoggingInAsNewUserSessionUtils(transitionURL ?? undefined, sessionEmail); - // We don't want to navigate to the exitTo route when creating a new workspace from a deep link, - // because we already handle creating the optimistic policy and navigating to it in App.setUpPoliciesAndNavigate, - // which is already called when AuthScreens mounts. - // For HybridApp we have separate logic to handle transitions. - if (!CONFIG.IS_HYBRID_APP && exitToPath !== ROUTES.WORKSPACE_NEW && !isAccountLoading && !isLoggingInAsNewUser) { - Navigation.isNavigationReady().then(() => { - // remove this screen and navigate to exit route - Navigation.goBack(); - if (exitToPath) { - Navigation.navigate(exitToPath as Route); - } - }); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, - [initialURL, isAccountLoading, exitToPath] as React.DependencyList, - ); + useEffect(() => { + const sessionEmail = session?.email; + const transitionURL = CONFIG.IS_HYBRID_APP ? `${CONST.DEEPLINK_BASE_URL}${initialURL ?? ''}` : initialURL; + const isLoggingInAsNewUser = isLoggingInAsNewUserSessionUtils(transitionURL ?? undefined, sessionEmail); + // We don't want to navigate to the exitTo route when creating a new workspace from a deep link, + // because we already handle creating the optimistic policy and navigating to it in App.setUpPoliciesAndNavigate, + // which is already called when AuthScreens mounts. + // For HybridApp we have separate logic to handle transitions. + if (!CONFIG.IS_HYBRID_APP && exitTo !== ROUTES.WORKSPACE_NEW && !isAccountLoading && !isLoggingInAsNewUser) { + Navigation.isNavigationReady().then(() => { + // remove this screen and navigate to exit route + Navigation.goBack(); + if (exitTo) { + Navigation.navigate(exitTo as Route); + } + }); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [initialURL, isAccountLoading]); return ; } diff --git a/src/pages/PrivateNotes/PrivateNotesListPage.tsx b/src/pages/PrivateNotes/PrivateNotesListPage.tsx index ee4d0c8688dea..24c2d1d720c53 100644 --- a/src/pages/PrivateNotes/PrivateNotesListPage.tsx +++ b/src/pages/PrivateNotes/PrivateNotesListPage.tsx @@ -39,7 +39,7 @@ type NoteListItem = { function PrivateNotesListPage({report, accountID: sessionAccountID}: PrivateNotesListPageProps) { const route = useRoute>(); - const backTo: string | undefined = route.params.backTo; + const backTo = route.params.backTo; const [personalDetailsList] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); const styles = useThemeStyles(); const {translate} = useLocalize(); @@ -70,25 +70,22 @@ function PrivateNotesListPage({report, accountID: sessionAccountID}: PrivateNote /** * Returns a list of private notes on the given chat report */ - const privateNotes = useMemo( - () => { - const privateNoteBrickRoadIndicator = (accountID: number) => (report.privateNotes?.[accountID].errors ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined); - return Object.keys(report.privateNotes ?? {}).map((privateNoteAccountID: string) => { - const accountID = Number(privateNoteAccountID); - const privateNote = report.privateNotes?.[accountID]; - return { - reportID: report.reportID, - accountID: privateNoteAccountID, - title: Number(sessionAccountID) === accountID ? translate('privateNotes.myNote') : (personalDetailsList?.[privateNoteAccountID]?.login ?? ''), - action: () => Navigation.navigate(ROUTES.PRIVATE_NOTES_EDIT.getRoute(report.reportID, accountID, backTo)), - brickRoadIndicator: privateNoteBrickRoadIndicator(accountID), - note: privateNote?.note ?? '', - disabled: Number(sessionAccountID) !== accountID, - }; - }); - }, - [report, personalDetailsList, sessionAccountID, translate, backTo] as React.DependencyList, - ); + const privateNotes = useMemo(() => { + const privateNoteBrickRoadIndicator = (accountID: number) => (report.privateNotes?.[accountID].errors ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined); + return Object.keys(report.privateNotes ?? {}).map((privateNoteAccountID: string) => { + const accountID = Number(privateNoteAccountID); + const privateNote = report.privateNotes?.[accountID]; + return { + reportID: report.reportID, + accountID: privateNoteAccountID, + title: Number(sessionAccountID) === accountID ? translate('privateNotes.myNote') : (personalDetailsList?.[privateNoteAccountID]?.login ?? ''), + action: () => Navigation.navigate(ROUTES.PRIVATE_NOTES_EDIT.getRoute(report.reportID, accountID, backTo)), + brickRoadIndicator: privateNoteBrickRoadIndicator(accountID), + note: privateNote?.note ?? '', + disabled: Number(sessionAccountID) !== accountID, + }; + }); + }, [report, personalDetailsList, sessionAccountID, translate, backTo]); return ( diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index ce2dd81ff9721..56fae5c5f9d17 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -162,7 +162,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail const activePolicy = useActivePolicy(); const styles = useThemeStyles(); const expensifyIcons = useMemoizedLazyExpensifyIcons(['Users', 'Gear', 'Send', 'Folder', 'UserPlus', 'Pencil', 'Checkmark', 'Building', 'Exit', 'Bug', 'Camera', 'Trashcan']); - const backTo: string | undefined = route.params.backTo; + const backTo = route.params.backTo; const [userBillingGraceEndPeriodCollection] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED); @@ -533,7 +533,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail translationKey: 'task.markAsIncomplete', isAnonymousAction: false, action: callFunctionIfActionIsAllowed(() => { - Navigation.goBack(backTo as Route | undefined); + Navigation.goBack(backTo); reopenTask(report, parentReport, currentUserPersonalDetails?.accountID); }), }); @@ -741,7 +741,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail return result; }, - [canJoin, report, backTo, currentUserPersonalDetails.accountID] as React.DependencyList, + [canJoin, report, backTo, currentUserPersonalDetails.accountID], ); const nameSectionExpenseIOU = ( @@ -1036,7 +1036,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail Navigation.goBack(backTo as Route | undefined)} + onBackButtonPress={() => Navigation.goBack(backTo)} /> diff --git a/src/pages/domain/BaseVerifyDomainPage.tsx b/src/pages/domain/BaseVerifyDomainPage.tsx index 641a130ca0906..6fc1f0eaef4df 100644 --- a/src/pages/domain/BaseVerifyDomainPage.tsx +++ b/src/pages/domain/BaseVerifyDomainPage.tsx @@ -48,7 +48,6 @@ function BaseVerifyDomainPage({domainAccountID, forwardTo}: BaseVerifyDomainPage const styles = useThemeStyles(); const theme = useTheme(); const {translate} = useLocalize(); - const forwardToPath: string = forwardTo; const [domain, domainMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN}${domainAccountID}`); const domainName = domain ? Str.extractEmailDomain(domain.email) : ''; @@ -56,15 +55,12 @@ function BaseVerifyDomainPage({domainAccountID, forwardTo}: BaseVerifyDomainPage const {asset: Exclamation} = useMemoizedLazyAsset(() => loadExpensifyIcon('Exclamation')); - useEffect( - () => { - if (!domain?.hasValidationSucceeded) { - return; - } - Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.navigate(forwardToPath as Route, {forceReplace: true})); - }, - [domain?.hasValidationSucceeded, forwardToPath] as React.DependencyList, - ); + useEffect(() => { + if (!domain?.hasValidationSucceeded) { + return; + } + Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.navigate(forwardTo, {forceReplace: true})); + }, [domainAccountID, domain?.hasValidationSucceeded, forwardTo]); useEffect(() => { if (!doesDomainExist) { diff --git a/src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx b/src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx index 2568377892906..43feb1062dc88 100644 --- a/src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx +++ b/src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx @@ -30,7 +30,7 @@ function ContactMethodsPage({route}: ContactMethodsPageProps) { const {translate} = useLocalize(); const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST); const [session] = useOnyx(ONYXKEYS.SESSION); - const navigateBackTo: string | undefined = route?.params?.backTo; + const navigateBackTo = route?.params?.backTo; const {isActingAsDelegate} = useDelegateNoAccessState(); const {showDelegateNoAccessModal} = useDelegateNoAccessActions(); diff --git a/src/pages/settings/VerifyAccountPageBase.tsx b/src/pages/settings/VerifyAccountPageBase.tsx index 1961c21ffda81..ece42ffe47592 100644 --- a/src/pages/settings/VerifyAccountPageBase.tsx +++ b/src/pages/settings/VerifyAccountPageBase.tsx @@ -29,7 +29,6 @@ function VerifyAccountPageBase({navigateBackTo, navigateForwardTo, handleClose, const styles = useThemeStyles(); const [account] = useOnyx(ONYXKEYS.ACCOUNT); const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST); - const navigateForwardToPath: string | undefined = navigateForwardTo; const currentUserPersonalDetails = useCurrentUserPersonalDetails(); // sometimes primaryLogin can be empty string // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing @@ -65,13 +64,12 @@ function VerifyAccountPageBase({navigateBackTo, navigateForwardTo, handleClose, onValidationSuccess?.(); - if (navigateForwardToPath) { - Navigation.navigate(navigateForwardToPath as Route, {forceReplace: true}); + if (navigateForwardTo) { + Navigation.navigate(navigateForwardTo, {forceReplace: true}); } else { handleCloseWithFallback(); } - }, - [isUserValidated, navigateForwardToPath, handleCloseWithFallback, onValidationSuccess] as React.DependencyList, + }, [isUserValidated, navigateForwardTo, handleCloseWithFallback, handleClose, onValidationSuccess] ); // Once user is validated or the modal is dismissed, we don't want to show empty content. From 30d090d102df0c51b45f31c5b72c4ebc1c95e3cc Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Wed, 11 Mar 2026 10:44:12 +0430 Subject: [PATCH 07/13] reverted unwanted file changes --- src/pages/PrivateNotes/PrivateNotesListPage.tsx | 2 +- src/pages/ReportDetailsPage.tsx | 14 +++++++------- src/pages/domain/BaseVerifyDomainPage.tsx | 2 +- src/pages/settings/VerifyAccountPageBase.tsx | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/pages/PrivateNotes/PrivateNotesListPage.tsx b/src/pages/PrivateNotes/PrivateNotesListPage.tsx index 24c2d1d720c53..69609d602f159 100644 --- a/src/pages/PrivateNotes/PrivateNotesListPage.tsx +++ b/src/pages/PrivateNotes/PrivateNotesListPage.tsx @@ -70,7 +70,7 @@ function PrivateNotesListPage({report, accountID: sessionAccountID}: PrivateNote /** * Returns a list of private notes on the given chat report */ - const privateNotes = useMemo(() => { + const privateNotes = useMemo(() => { const privateNoteBrickRoadIndicator = (accountID: number) => (report.privateNotes?.[accountID].errors ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined); return Object.keys(report.privateNotes ?? {}).map((privateNoteAccountID: string) => { const accountID = Number(privateNoteAccountID); diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index 56fae5c5f9d17..0bf238fba82a1 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -729,15 +729,15 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail () => { const result: PromotedAction[] = []; - if (canJoin) { - result.push(PromotedActions.join(report, currentUserPersonalDetails.accountID)); - } + if (canJoin) { + result.push(PromotedActions.join(report, currentUserPersonalDetails.accountID)); + } - if (report) { - result.push(PromotedActions.pin(report)); - } + if (report) { + result.push(PromotedActions.pin(report)); + } - result.push(PromotedActions.share(report, backTo)); + result.push(PromotedActions.share(report, backTo)); return result; }, diff --git a/src/pages/domain/BaseVerifyDomainPage.tsx b/src/pages/domain/BaseVerifyDomainPage.tsx index 6fc1f0eaef4df..b2a3d40fdf8df 100644 --- a/src/pages/domain/BaseVerifyDomainPage.tsx +++ b/src/pages/domain/BaseVerifyDomainPage.tsx @@ -55,7 +55,7 @@ function BaseVerifyDomainPage({domainAccountID, forwardTo}: BaseVerifyDomainPage const {asset: Exclamation} = useMemoizedLazyAsset(() => loadExpensifyIcon('Exclamation')); - useEffect(() => { + useEffect(() => { if (!domain?.hasValidationSucceeded) { return; } diff --git a/src/pages/settings/VerifyAccountPageBase.tsx b/src/pages/settings/VerifyAccountPageBase.tsx index ece42ffe47592..4f05cd46bee78 100644 --- a/src/pages/settings/VerifyAccountPageBase.tsx +++ b/src/pages/settings/VerifyAccountPageBase.tsx @@ -62,7 +62,7 @@ function VerifyAccountPageBase({navigateBackTo, navigateForwardTo, handleClose, return; } - onValidationSuccess?.(); + onValidationSuccess?.(); if (navigateForwardTo) { Navigation.navigate(navigateForwardTo, {forceReplace: true}); From bbaadb0abde96b36bcb996a82b47145fec297909 Mon Sep 17 00:00:00 2001 From: marufsharifi Date: Wed, 11 Mar 2026 16:38:20 +0430 Subject: [PATCH 08/13] Fix exported-to filter route --- src/libs/Navigation/linkingConfig/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index 8c26a1208c840..dd815d4985f65 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -1919,9 +1919,9 @@ const config: LinkingOptions['config'] = { [SCREENS.SEARCH.ADVANCED_FILTERS_APPROVED_RHP]: `${ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.APPROVED)}/:subPage?`, [SCREENS.SEARCH.ADVANCED_FILTERS_PAID_RHP]: `${ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.PAID)}/:subPage?`, [SCREENS.SEARCH.ADVANCED_FILTERS_EXPORTED_RHP]: `${ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED)}/:subPage?`, - [SCREENS.SEARCH.ADVANCED_FILTERS_EXPORTED_TO_RHP]: `${ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.EXPORTED_TO)}/:subPage`, [SCREENS.SEARCH.ADVANCED_FILTERS_POSTED_RHP]: `${ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.POSTED)}/:subPage?`, [SCREENS.SEARCH.ADVANCED_FILTERS_WITHDRAWN_RHP]: `${ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWN)}/:subPage?`, + [SCREENS.SEARCH.ADVANCED_FILTERS_EXPORTED_TO_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.EXPORTED_TO), [SCREENS.SEARCH.ADVANCED_FILTERS_CURRENCY_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.CURRENCY), [SCREENS.SEARCH.ADVANCED_FILTERS_GROUP_CURRENCY_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.GROUP_CURRENCY), [SCREENS.SEARCH.ADVANCED_FILTERS_MERCHANT_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.MERCHANT), From 90d8288c1278f89db9b2f7618e60587b4d4ce01d Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Thu, 12 Mar 2026 17:32:00 +0430 Subject: [PATCH 09/13] fixed prettier --- src/pages/ReportDetailsPage.tsx | 11 ++++------ src/pages/domain/BaseDomainVerifiedPage.tsx | 15 ++++++------- src/pages/settings/VerifyAccountPageBase.tsx | 22 +++++++++----------- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index 0bf238fba82a1..da4bb7a036755 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -725,9 +725,8 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail const canJoin = canJoinChat(report, parentReportAction, policy, parentReport, !!reportNameValuePairs?.private_isArchived); - const promotedActions = useMemo( - () => { - const result: PromotedAction[] = []; + const promotedActions = useMemo(() => { + const result: PromotedAction[] = []; if (canJoin) { result.push(PromotedActions.join(report, currentUserPersonalDetails.accountID)); @@ -739,10 +738,8 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail result.push(PromotedActions.share(report, backTo)); - return result; - }, - [canJoin, report, backTo, currentUserPersonalDetails.accountID], - ); + return result; + }, [canJoin, report, backTo, currentUserPersonalDetails.accountID]); const nameSectionExpenseIOU = ( diff --git a/src/pages/domain/BaseDomainVerifiedPage.tsx b/src/pages/domain/BaseDomainVerifiedPage.tsx index e3a0c414897bd..d46b2ff5672ef 100644 --- a/src/pages/domain/BaseDomainVerifiedPage.tsx +++ b/src/pages/domain/BaseDomainVerifiedPage.tsx @@ -34,15 +34,12 @@ function BaseDomainVerifiedPage({domainAccountID, redirectTo}: BaseDomainVerifie const [isAdmin, isAdminMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_ADMIN_ACCESS}${domainAccountID}`); const doesDomainExist = !!domain; - useEffect( - () => { - if (!doesDomainExist || domain?.validated) { - return; - } - Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.navigate(redirectToPath as Route, {forceReplace: true})); - }, - [domain?.validated, doesDomainExist, redirectToPath] as React.DependencyList, - ); + useEffect(() => { + if (!doesDomainExist || domain?.validated) { + return; + } + Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.navigate(redirectToPath as Route, {forceReplace: true})); + }, [domain?.validated, doesDomainExist, redirectToPath]); if (isLoadingOnyxValue(domainMetadata, isAdminMetadata)) { return ; diff --git a/src/pages/settings/VerifyAccountPageBase.tsx b/src/pages/settings/VerifyAccountPageBase.tsx index 4f05cd46bee78..806ef42266700 100644 --- a/src/pages/settings/VerifyAccountPageBase.tsx +++ b/src/pages/settings/VerifyAccountPageBase.tsx @@ -56,21 +56,19 @@ function VerifyAccountPageBase({navigateBackTo, navigateForwardTo, handleClose, }, [handleClose, navigateBackTo]); // Handle navigation once the user is validated - useEffect( - () => { - if (!isUserValidated) { - return; - } + useEffect(() => { + if (!isUserValidated) { + return; + } onValidationSuccess?.(); - if (navigateForwardTo) { - Navigation.navigate(navigateForwardTo, {forceReplace: true}); - } else { - handleCloseWithFallback(); - } - }, [isUserValidated, navigateForwardTo, handleCloseWithFallback, handleClose, onValidationSuccess] - ); + if (navigateForwardTo) { + Navigation.navigate(navigateForwardTo, {forceReplace: true}); + } else { + handleCloseWithFallback(); + } + }, [isUserValidated, navigateForwardTo, handleCloseWithFallback, handleClose, onValidationSuccess]); // Once user is validated or the modal is dismissed, we don't want to show empty content. if (isUserValidated) { From 8480a4373159a35785d1deaedd9187ad8ed0938f Mon Sep 17 00:00:00 2001 From: marufsharifi Date: Sun, 15 Mar 2026 22:40:17 -0700 Subject: [PATCH 10/13] Use lowercase date filter subpage paths --- src/CONST/index.ts | 3 +++ .../Search/SearchDatePresetFilterBasePage.tsx | 27 ++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/CONST/index.ts b/src/CONST/index.ts index 083cd242abbf9..6c4b0cb9e888b 100644 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -7772,6 +7772,9 @@ const CONST = { }, DATE_FILTER_SUB_PAGE: { MAIN: 'main', + ON: 'on', + AFTER: 'after', + BEFORE: 'before', }, AMOUNT_MODIFIERS: { LESS_THAN: 'LessThan', diff --git a/src/components/Search/SearchDatePresetFilterBasePage.tsx b/src/components/Search/SearchDatePresetFilterBasePage.tsx index 0b7e24d9faff0..563c3150d4ada 100644 --- a/src/components/Search/SearchDatePresetFilterBasePage.tsx +++ b/src/components/Search/SearchDatePresetFilterBasePage.tsx @@ -24,9 +24,9 @@ function EmptySubPageComponent() { const DATE_FILTER_SUB_PAGES: Array> = [ {pageName: CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN, component: EmptySubPageComponent}, - {pageName: CONST.SEARCH.DATE_MODIFIERS.ON, component: EmptySubPageComponent}, - {pageName: CONST.SEARCH.DATE_MODIFIERS.AFTER, component: EmptySubPageComponent}, - {pageName: CONST.SEARCH.DATE_MODIFIERS.BEFORE, component: EmptySubPageComponent}, + {pageName: CONST.SEARCH.DATE_FILTER_SUB_PAGE.ON, component: EmptySubPageComponent}, + {pageName: CONST.SEARCH.DATE_FILTER_SUB_PAGE.AFTER, component: EmptySubPageComponent}, + {pageName: CONST.SEARCH.DATE_FILTER_SUB_PAGE.BEFORE, component: EmptySubPageComponent}, ]; type SearchDatePresetFilterBasePageProps = { @@ -87,8 +87,16 @@ function SearchDatePresetFilterBasePage({dateKey, titleKey}: SearchDatePresetFil }); const selectedDateModifier = useMemo(() => { - if (currentPageName === CONST.SEARCH.DATE_MODIFIERS.ON || currentPageName === CONST.SEARCH.DATE_MODIFIERS.AFTER || currentPageName === CONST.SEARCH.DATE_MODIFIERS.BEFORE) { - return currentPageName; + if (currentPageName === CONST.SEARCH.DATE_FILTER_SUB_PAGE.ON) { + return CONST.SEARCH.DATE_MODIFIERS.ON; + } + + if (currentPageName === CONST.SEARCH.DATE_FILTER_SUB_PAGE.AFTER) { + return CONST.SEARCH.DATE_MODIFIERS.AFTER; + } + + if (currentPageName === CONST.SEARCH.DATE_FILTER_SUB_PAGE.BEFORE) { + return CONST.SEARCH.DATE_MODIFIERS.BEFORE; } return null; @@ -101,7 +109,14 @@ function SearchDatePresetFilterBasePage({dateKey, titleKey}: SearchDatePresetFil return; } - resetToPage(dateModifier); + const subPage = + dateModifier === CONST.SEARCH.DATE_MODIFIERS.ON + ? CONST.SEARCH.DATE_FILTER_SUB_PAGE.ON + : dateModifier === CONST.SEARCH.DATE_MODIFIERS.AFTER + ? CONST.SEARCH.DATE_FILTER_SUB_PAGE.AFTER + : CONST.SEARCH.DATE_FILTER_SUB_PAGE.BEFORE; + + resetToPage(subPage); }, [buildSubPageRoute, resetToPage], ); From f7b21d999325b35cf150b6d661f16def5d7babfc Mon Sep 17 00:00:00 2001 From: marufsharifi Date: Mon, 16 Mar 2026 13:12:57 -0700 Subject: [PATCH 11/13] Fix date preset filter lint/type issue --- .../Search/SearchDatePresetFilterBasePage.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/components/Search/SearchDatePresetFilterBasePage.tsx b/src/components/Search/SearchDatePresetFilterBasePage.tsx index 563c3150d4ada..a65fa639aa1bb 100644 --- a/src/components/Search/SearchDatePresetFilterBasePage.tsx +++ b/src/components/Search/SearchDatePresetFilterBasePage.tsx @@ -109,14 +109,17 @@ function SearchDatePresetFilterBasePage({dateKey, titleKey}: SearchDatePresetFil return; } - const subPage = - dateModifier === CONST.SEARCH.DATE_MODIFIERS.ON - ? CONST.SEARCH.DATE_FILTER_SUB_PAGE.ON - : dateModifier === CONST.SEARCH.DATE_MODIFIERS.AFTER - ? CONST.SEARCH.DATE_FILTER_SUB_PAGE.AFTER - : CONST.SEARCH.DATE_FILTER_SUB_PAGE.BEFORE; - - resetToPage(subPage); + if (dateModifier === CONST.SEARCH.DATE_MODIFIERS.ON) { + resetToPage(CONST.SEARCH.DATE_FILTER_SUB_PAGE.ON); + return; + } + + if (dateModifier === CONST.SEARCH.DATE_MODIFIERS.AFTER) { + resetToPage(CONST.SEARCH.DATE_FILTER_SUB_PAGE.AFTER); + return; + } + + resetToPage(CONST.SEARCH.DATE_FILTER_SUB_PAGE.BEFORE); }, [buildSubPageRoute, resetToPage], ); From d5db688d064ba6a7eaf3b5ca6dc1fa38949742fd Mon Sep 17 00:00:00 2001 From: marufsharifi Date: Wed, 18 Mar 2026 14:12:36 +0430 Subject: [PATCH 12/13] refactor: simplify search date filter subpage navigation --- src/CONST/index.ts | 1 - .../Search/SearchDatePresetFilterBasePage.tsx | 65 +++++-------------- src/pages/Search/AdvancedSearchFilters.tsx | 14 ++-- 3 files changed, 25 insertions(+), 55 deletions(-) diff --git a/src/CONST/index.ts b/src/CONST/index.ts index 9a1385975b889..cd0b29b2b33db 100644 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -7818,7 +7818,6 @@ const CONST = { BEFORE: 'Before', }, DATE_FILTER_SUB_PAGE: { - MAIN: 'main', ON: 'on', AFTER: 'after', BEFORE: 'before', diff --git a/src/components/Search/SearchDatePresetFilterBasePage.tsx b/src/components/Search/SearchDatePresetFilterBasePage.tsx index a65fa639aa1bb..0fae8d0c58570 100644 --- a/src/components/Search/SearchDatePresetFilterBasePage.tsx +++ b/src/components/Search/SearchDatePresetFilterBasePage.tsx @@ -1,10 +1,8 @@ -import React, {useCallback, useMemo} from 'react'; -import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; +import {useRoute} from '@react-navigation/native'; +import React, {useCallback} from 'react'; import ScreenWrapper from '@components/ScreenWrapper'; import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; -import useSubPage from '@hooks/useSubPage'; -import type {PageConfig, SubPageProps} from '@hooks/useSubPage/types'; import useThemeStyles from '@hooks/useThemeStyles'; import {updateAdvancedFilters} from '@libs/actions/Search'; import Navigation from '@libs/Navigation/Navigation'; @@ -18,17 +16,6 @@ import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue'; import DateFilterBase from './FilterComponents/DateFilterBase'; import type {ReportFieldDateKey, SearchDateFilterKeys, SearchFilterKey} from './types'; -function EmptySubPageComponent() { - return null; -} - -const DATE_FILTER_SUB_PAGES: Array> = [ - {pageName: CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN, component: EmptySubPageComponent}, - {pageName: CONST.SEARCH.DATE_FILTER_SUB_PAGE.ON, component: EmptySubPageComponent}, - {pageName: CONST.SEARCH.DATE_FILTER_SUB_PAGE.AFTER, component: EmptySubPageComponent}, - {pageName: CONST.SEARCH.DATE_FILTER_SUB_PAGE.BEFORE, component: EmptySubPageComponent}, -]; - type SearchDatePresetFilterBasePageProps = { /** Key used for the date filter */ dateKey: Extract; @@ -40,6 +27,8 @@ type SearchDatePresetFilterBasePageProps = { function SearchDatePresetFilterBasePage({dateKey, titleKey}: SearchDatePresetFilterBasePageProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); + const route = useRoute(); + const params = route.params as {subPage?: string} | undefined; const [searchAdvancedFiltersForm, searchAdvancedFiltersFormMetadata] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM); const isSearchAdvancedFiltersFormLoading = isLoadingOnyxValue(searchAdvancedFiltersFormMetadata); @@ -77,57 +66,39 @@ function SearchDatePresetFilterBasePage({dateKey, titleKey}: SearchDatePresetFil Navigation.goBack(ROUTES.SEARCH_ADVANCED_FILTERS.getRoute()); }, []); - const buildSubPageRoute = useCallback((subPage: string) => ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(dateKey, subPage), [dateKey]); - - const {currentPageName, resetToPage, isRedirecting} = useSubPage({ - pages: DATE_FILTER_SUB_PAGES, - startFrom: 0, - onFinished: goBack, - buildRoute: buildSubPageRoute, - }); - - const selectedDateModifier = useMemo(() => { - if (currentPageName === CONST.SEARCH.DATE_FILTER_SUB_PAGE.ON) { - return CONST.SEARCH.DATE_MODIFIERS.ON; - } + const buildSubPageRoute = useCallback((subPage?: string) => ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(dateKey, subPage), [dateKey]); - if (currentPageName === CONST.SEARCH.DATE_FILTER_SUB_PAGE.AFTER) { - return CONST.SEARCH.DATE_MODIFIERS.AFTER; - } - - if (currentPageName === CONST.SEARCH.DATE_FILTER_SUB_PAGE.BEFORE) { - return CONST.SEARCH.DATE_MODIFIERS.BEFORE; - } - - return null; - }, [currentPageName]); + let selectedDateModifier: SearchDateModifier | null = null; + if (params?.subPage === CONST.SEARCH.DATE_FILTER_SUB_PAGE.ON) { + selectedDateModifier = CONST.SEARCH.DATE_MODIFIERS.ON; + } else if (params?.subPage === CONST.SEARCH.DATE_FILTER_SUB_PAGE.AFTER) { + selectedDateModifier = CONST.SEARCH.DATE_MODIFIERS.AFTER; + } else if (params?.subPage === CONST.SEARCH.DATE_FILTER_SUB_PAGE.BEFORE) { + selectedDateModifier = CONST.SEARCH.DATE_MODIFIERS.BEFORE; + } const selectDateModifier = useCallback( (dateModifier: SearchDateModifier | null) => { if (!dateModifier) { - Navigation.goBack(buildSubPageRoute(CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN)); + Navigation.goBack(buildSubPageRoute()); return; } if (dateModifier === CONST.SEARCH.DATE_MODIFIERS.ON) { - resetToPage(CONST.SEARCH.DATE_FILTER_SUB_PAGE.ON); + Navigation.navigate(buildSubPageRoute(CONST.SEARCH.DATE_FILTER_SUB_PAGE.ON)); return; } if (dateModifier === CONST.SEARCH.DATE_MODIFIERS.AFTER) { - resetToPage(CONST.SEARCH.DATE_FILTER_SUB_PAGE.AFTER); + Navigation.navigate(buildSubPageRoute(CONST.SEARCH.DATE_FILTER_SUB_PAGE.AFTER)); return; } - resetToPage(CONST.SEARCH.DATE_FILTER_SUB_PAGE.BEFORE); + Navigation.navigate(buildSubPageRoute(CONST.SEARCH.DATE_FILTER_SUB_PAGE.BEFORE)); }, - [buildSubPageRoute, resetToPage], + [buildSubPageRoute], ); - if (isRedirecting) { - return ; - } - const defaultDateValues = getDefaultDateValues(); const presets = getPresets(); diff --git a/src/pages/Search/AdvancedSearchFilters.tsx b/src/pages/Search/AdvancedSearchFilters.tsx index 3d9b5745daaba..ae5d0a263d323 100644 --- a/src/pages/Search/AdvancedSearchFilters.tsx +++ b/src/pages/Search/AdvancedSearchFilters.tsx @@ -81,27 +81,27 @@ const baseFilterConfig = { date: { getTitle: getFilterDisplayTitle, description: 'common.date' as const, - route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE, CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN), + route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE), }, submitted: { getTitle: getFilterDisplayTitle, description: 'search.filters.submitted' as const, - route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.SUBMITTED, CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN), + route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.SUBMITTED), }, approved: { getTitle: getFilterDisplayTitle, description: 'search.filters.approved' as const, - route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.APPROVED, CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN), + route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.APPROVED), }, paid: { getTitle: getFilterDisplayTitle, description: 'search.filters.paid' as const, - route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.PAID, CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN), + route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.PAID), }, exported: { getTitle: getFilterDisplayTitle, description: 'search.filters.exported' as const, - route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED, CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN), + route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED), }, exportedTo: { getTitle: getFilterDisplayTitle, @@ -111,12 +111,12 @@ const baseFilterConfig = { posted: { getTitle: getFilterDisplayTitle, description: 'search.filters.posted' as const, - route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.POSTED, CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN), + route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.POSTED), }, withdrawn: { getTitle: getFilterDisplayTitle, description: 'search.filters.withdrawn' as const, - route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWN, CONST.SEARCH.DATE_FILTER_SUB_PAGE.MAIN), + route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWN), }, currency: { getTitle: getFilterDisplayTitle, From 02e5952395955e74cc676518c5107f9dc2f74c34 Mon Sep 17 00:00:00 2001 From: marufsharifi Date: Thu, 19 Mar 2026 01:36:45 +0430 Subject: [PATCH 13/13] Revert unrelated domain change and remove subPage encoding --- src/ROUTES.ts | 2 +- src/pages/domain/BaseDomainVerifiedPage.tsx | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 956fc25641437..26765e71ce798 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -143,7 +143,7 @@ const ROUTES = { if (!subPage || !filterKey) { return baseRoute; } - return `${baseRoute}/${encodeURIComponent(subPage)}` as const; + return `${baseRoute}/${subPage}` as const; }, }, SEARCH_REPORT: { diff --git a/src/pages/domain/BaseDomainVerifiedPage.tsx b/src/pages/domain/BaseDomainVerifiedPage.tsx index eb39d33cf852c..84128d37cadb0 100644 --- a/src/pages/domain/BaseDomainVerifiedPage.tsx +++ b/src/pages/domain/BaseDomainVerifiedPage.tsx @@ -29,7 +29,6 @@ type BaseDomainVerifiedPageProps = { function BaseDomainVerifiedPage({domainAccountID, redirectTo}: BaseDomainVerifiedPageProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); - const redirectToPath: string = redirectTo; const [domain, domainMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN}${domainAccountID}`); const [isAdmin, isAdminMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_ADMIN_ACCESS}${domainAccountID}`); @@ -39,8 +38,8 @@ function BaseDomainVerifiedPage({domainAccountID, redirectTo}: BaseDomainVerifie if (!doesDomainExist || domain?.validated) { return; } - Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.navigate(redirectToPath as Route, {forceReplace: true})); - }, [domain?.validated, doesDomainExist, redirectToPath]); + Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.navigate(redirectTo, {forceReplace: true})); + }, [domainAccountID, domain?.validated, doesDomainExist, redirectTo]); if (isLoadingOnyxValue(domainMetadata, isAdminMetadata)) { const reasonAttributes: SkeletonSpanReasonAttributes = {