Skip to content

Back button on split RHP show the page twice #78080

Closed

Description

@mitarachim

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.2.82-0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #74652
Email or phone of affected tester (no customers): testpayment935@gmail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Windows 11 pro /Chrome, Samsung Galaxy s10/ Chrome
App Component: Money Requests

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Create workspace and add expense
  3. Go to expense detail page > More > Split > Date > Split dates
  4. Click top back button twice

Expected Result:

Split RHP should be shown only once when tapping back button

Actual Result:

Back button on split RHP show the page twice rather than navigating back to expense detail

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Bug7033259_1766096368524.bandicam_2025-12-19_01-12-51-506.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCash
    Daily
    Bug
    DeployBlocker
    on Dec 19, 2025
  2. melvin-bot commented on Dec 19, 2025

    @melvin-bot

    Triggered auto assignment to @johncschuster (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. melvin-bot commented on Dec 19, 2025

    @melvin-bot

    Triggered auto assignment to @MonilBhavsar (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  4. melvin-bot commented on Dec 19, 2025

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  5. github-actions commented on Dec 19, 2025

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  6. nyomanjyotisa commented on Dec 19, 2025

    @nyomanjyotisa
    Member

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Back button on split RHP show the page twice

    What is the root cause of that problem?

    When navigating to the split dates page from the split expense page, we're passing Navigation.getActiveRoute as the backTo parameter

    Navigation.navigate(ROUTES.SPLIT_EXPENSE_CREATE_DATE_RANGE.getRoute(reportID, transactionID, Navigation.getActiveRoute()));

    This causes the split dates page to have a backTo parameter pointing back to the split expense page. When the user clicks back from the split dates page, Navigation.goBack(backTo) is called, which navigates to the backTo route

    const handleBackPress = () => {
    Navigation.goBack(backTo);
    };

    Since backTo points to the split expense page (which is already in the navigation stack), this creates a duplicate navigation entry

    What changes do you think we should make in order to solve the problem?

    Remove the backTo parameter when navigating to the split dates page from the split expense page

        const handleDatePress = useCallback(() => {
            Navigation.navigate(ROUTES.SPLIT_EXPENSE_CREATE_DATE_RANGE.getRoute(reportID, transactionID));
        }, [reportID, transactionID]);

    const handleDatePress = useCallback(() => {
    Navigation.navigate(ROUTES.SPLIT_EXPENSE_CREATE_DATE_RANGE.getRoute(reportID, transactionID, Navigation.getActiveRoute()));
    }, [reportID, transactionID]);

    What alternative solutions did you explore? (Optional)

    None

  7. lakchote commented on Dec 19, 2025

    @lakchote
    Contributor
  8. WojtekBoman commented on Dec 19, 2025

    @WojtekBoman
    Contributor

    Hey I checked and this issue can be reproduced this way as well:

    Screen.Recording.2025-12-19.at.11.35.58.mov

    I solved that using the specific routes to go back instead of backTo. I believe we can solve it the same way for the case described in this issue, let's just replace the backTo occurrences with the default go back routes. Problems might appear if the pages where backTo is used are accessed from several different flows. Then we need to reconsider the solution

    diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts
    index fd11c989c50..91eacba53ac 100644
    --- a/src/libs/actions/IOU.ts
    +++ b/src/libs/actions/IOU.ts
    @@ -14501,7 +14501,7 @@ function initDraftSplitExpenseDataForEdit(draftTransaction: OnyxEntry<OnyxTypes.
     
         Onyx.set(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`, editDraftTransaction);
     
    -    Navigation.navigate(ROUTES.SPLIT_EXPENSE_EDIT.getRoute(reportID, originalTransactionID, splitTransactionData?.transactionID, Navigation.getActiveRoute()));
    +    Navigation.navigate(ROUTES.SPLIT_EXPENSE_EDIT.getRoute(reportID, originalTransactionID, splitTransactionData?.transactionID));
     }
     
     /**
    diff --git a/src/pages/iou/SplitExpenseEditPage.tsx b/src/pages/iou/SplitExpenseEditPage.tsx
    index 96ed74401c3..dcb3d0b4b34 100644
    --- a/src/pages/iou/SplitExpenseEditPage.tsx
    +++ b/src/pages/iou/SplitExpenseEditPage.tsx
    @@ -133,7 +133,7 @@ function SplitExpenseEditPage({route}: SplitExpensePageProps) {
                                 amount: convertToDisplayString(currentAmount, splitExpenseDraftTransactionDetails?.currency),
                                 merchant: splitExpenseDraftTransaction?.merchant ?? '',
                             })}
    -                        onBackButtonPress={() => Navigation.goBack(backTo)}
    +                        onBackButtonPress={() => Navigation.goBack(ROUTES.SPLIT_EXPENSE.getRoute(reportID, transactionID))}
                         />
                         <ScrollView>
                             <MenuItemWithTopDescription
    @@ -259,7 +259,7 @@ function SplitExpenseEditPage({route}: SplitExpensePageProps) {
                                     text={translate('iou.removeSplit')}
                                     onPress={() => {
                                         removeSplitExpenseField(draftTransactionWithSplitExpenses, splitExpenseTransactionID);
    -                                    Navigation.goBack(backTo);
    +                                    Navigation.goBack(ROUTES.SPLIT_EXPENSE.getRoute(reportID, transactionID));
                                     }}
                                     pressOnEnter
                                     enterKeyEventListenerPriority={1}
  9. WojtekBoman commented on Dec 19, 2025

    @WojtekBoman
    Contributor
    diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts
    index f801571c4f0..665ee02415e 100644
    --- a/src/libs/actions/IOU.ts
    +++ b/src/libs/actions/IOU.ts
    @@ -14431,7 +14431,7 @@ function initSplitExpense(transactions: OnyxCollection<OnyxTypes.Transaction>, r
     
             Onyx.set(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`, draftTransaction);
     
    -        Navigation.navigate(ROUTES.SPLIT_EXPENSE.getRoute(reportID, originalTransactionID, transaction.transactionID, Navigation.getActiveRoute()));
    +        Navigation.navigate(ROUTES.SPLIT_EXPENSE.getRoute(reportID, originalTransactionID, transaction.transactionID));
             return;
         }
     
    @@ -14460,7 +14460,7 @@ function initSplitExpense(transactions: OnyxCollection<OnyxTypes.Transaction>, r
     
         Onyx.set(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transaction?.transactionID}`, draftTransaction);
     
    -    Navigation.navigate(ROUTES.SPLIT_EXPENSE.getRoute(reportID, transaction.transactionID, undefined, Navigation.getActiveRoute()));
    +    Navigation.navigate(ROUTES.SPLIT_EXPENSE.getRoute(reportID, transaction.transactionID, undefined));
     }
     
     /**
    @@ -14495,7 +14495,7 @@ function initDraftSplitExpenseDataForEdit(draftTransaction: OnyxEntry<OnyxTypes.
     
         Onyx.set(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`, editDraftTransaction);
     
    -    Navigation.navigate(ROUTES.SPLIT_EXPENSE_EDIT.getRoute(reportID, originalTransactionID, splitTransactionData?.transactionID, Navigation.getActiveRoute()));
    +    Navigation.navigate(ROUTES.SPLIT_EXPENSE_EDIT.getRoute(reportID, originalTransactionID, splitTransactionData?.transactionID));
     }
     
     /**
    diff --git a/src/pages/iou/SplitExpenseCreateDateRagePage.tsx b/src/pages/iou/SplitExpenseCreateDateRagePage.tsx
    index 7cb001e41d9..2d2cabc0e2f 100644
    --- a/src/pages/iou/SplitExpenseCreateDateRagePage.tsx
    +++ b/src/pages/iou/SplitExpenseCreateDateRagePage.tsx
    @@ -22,6 +22,7 @@ import {isSplitAction} from '@libs/ReportSecondaryActionUtils';
     import {getReportOrDraftReport} from '@libs/ReportUtils';
     import CONST from '@src/CONST';
     import ONYXKEYS from '@src/ONYXKEYS';
    +import ROUTES from '@src/ROUTES';
     import type SCREENS from '@src/SCREENS';
     import INPUT_IDS from '@src/types/form/SplitExpenseEditDateForm';
     import {isEmptyObject} from '@src/types/utils/EmptyObject';
    @@ -54,7 +55,7 @@ function SplitExpenseCreateDateRagePage({route}: SplitExpenseCreateDateRagePageP
     
         const updateDate = (value: FormOnyxValues<typeof ONYXKEYS.FORMS.SPLIT_EXPENSE_EDIT_DATES>) => {
             resetSplitExpensesByDateRange(transaction, value[INPUT_IDS.START_DATE], value[INPUT_IDS.END_DATE]);
    -        Navigation.goBack(backTo);
    +        Navigation.goBack(ROUTES.SPLIT_EXPENSE.getRoute(reportID, transactionID));
         };
     
         const isSplitAvailable = report && transaction && isSplitAction(currentReport, [transaction], originalTransaction, currentPolicy);
    @@ -83,7 +84,7 @@ function SplitExpenseCreateDateRagePage({route}: SplitExpenseCreateDateRagePageP
         };
     
         const handleBackPress = () => {
    -        Navigation.goBack(backTo);
    +        Navigation.goBack(ROUTES.SPLIT_EXPENSE.getRoute(reportID, transactionID));
         };
     
         return (
    diff --git a/src/pages/iou/SplitExpensePage.tsx b/src/pages/iou/SplitExpensePage.tsx
    index 36eef7439c3..dd36bfe5b42 100644
    --- a/src/pages/iou/SplitExpensePage.tsx
    +++ b/src/pages/iou/SplitExpensePage.tsx
    @@ -409,7 +409,7 @@ function SplitExpensePage({route}: SplitExpensePageProps) {
         }, [draftTransaction?.comment?.splitsStartDate, draftTransaction?.comment?.splitsEndDate, translate]);
     
         const handleDatePress = useCallback(() => {
    -        Navigation.navigate(ROUTES.SPLIT_EXPENSE_CREATE_DATE_RANGE.getRoute(reportID, transactionID, Navigation.getActiveRoute()));
    +        Navigation.navigate(ROUTES.SPLIT_EXPENSE_CREATE_DATE_RANGE.getRoute(reportID, transactionID));
         }, [reportID, transactionID]);
     
         const headerDateContent = useMemo(() => {

    @ZhenjaHorbach This should solve the problem. Actually, we'll lose the information about the report from which we opened the split expense page, but we can open the initial split expense page when navigating back after the refresh. Please let me know if it's ok

    Screen.Recording.2025-12-19.at.13.37.46.mov
  10. removed
    DeployBlocker
    on Dec 19, 2025
  11. ZhenjaHorbach commented on Dec 19, 2025

    @ZhenjaHorbach
    Contributor

    As for me, it looks good!
    @lakchote
    What do you think about it?

  12. added
    Reviewing
    on Dec 19, 2025
  13. removed
    DeployBlockerCash
    on Dec 19, 2025
  14. garrettmknight commented on Jan 2, 2026

    @garrettmknight
    Contributor

    Fixed! Handling payment in a separate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugEngineeringHourlyReviewing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions