Skip to content

QAB-App returns to Create expense after enter amount and click Next if Create expense from QAB #84363

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.3.32-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/TR-7762/folder/13176896/41237398/1232118060?sort=-identifier
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Win 11/Chrome
App Component: Money Requests

Action Performed:

  1. Open https://staging.new.expensify.com/
  2. Navigate to any workspace chat
  3. Create a manual expense
  4. At Inbox tab, click on + button
  5. Click on Create expense at QAB
  6. Type amount and click Next

Expected Result:

Confirm detail page should display

Actual Result:

App backs to Create expense page

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7095269_1772774370380.Recording__1875.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 6, 2026
  2. melvin-bot commented on Mar 6, 2026

    @melvin-bot

    Triggered auto assignment to @stephanieelliott (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 Mar 6, 2026

    @melvin-bot

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

  4. melvin-bot commented on Mar 6, 2026

    @melvin-bot

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

  5. github-actions commented on Mar 6, 2026

    @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. OSBotify commented on Mar 6, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #83888 - "Bump Onyx to 3.0.42" by @fabioh8010 (High confidence)
    Related Issues: None

    Recommendation: REVERT

    PR #83888 updated react-native-onyx from 3.0.41 to 3.0.42. This update appears to have introduced a regression in promise handling that breaks the expense creation flow from QAB.

    Labels: Keeping DeployBlockerCash (this is a Frontend bug blocking App deploy). Removing DeployBlocker since this does not affect the backend.

    Detailed Analysis

    Evidence

    The bug occurs specifically when creating a manual expense from the Quick Action Button (QAB):

    1. User navigates to Inbox tab and clicks + button
    2. Clicks "Create expense" at QAB
    3. Types amount and clicks Next
    4. Expected: Should navigate to confirmation page
    5. Actual: App backs to Create expense page (navigation fails)

    The bug is reproducible on staging (v9.3.32-0) but NOT on production, indicating it was introduced in this deploy.

    Verification

    In /home/runner/_work/App/App/src/pages/iou/request/step/IOURequestStepAmount.tsx at lines 319-321:

    setMoneyRequestParticipantsFromReport(transactionID, report, currentUserPersonalDetails.accountID).then(() => {
        navigateToConfirmationPage(iouType, transactionID, reportID, backToReport);
    });

    This code path is used when creating expenses from a workspace chat via QAB. The function setMoneyRequestParticipantsFromReport (defined in /home/runner/_work/App/App/src/libs/actions/IOU/index.ts at lines 12418-12424) returns an Onyx.merge() promise:

    function setMoneyRequestParticipantsFromReport(transactionID: string, report: OnyxEntry<OnyxTypes.Report>, currentUserAccountID?: number, participantsAutoAssigned = true) {
        const participants = getMoneyRequestParticipantsFromReport(report, currentUserAccountID);
        return Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {
            participants,
            participantsAutoAssigned,
        });
    }

    PR #83888 updated Onyx from 3.0.41 to 3.0.42, which included PR #732 in react-native-onyx. If this Onyx update changed promise behavior or introduced a regression in how Onyx.merge() promises resolve, it would cause the .then() callback to never execute, preventing navigation to the confirmation page and causing the app to "back" to the create expense page.

    Root Cause

    The Onyx 3.0.42 update introduced a regression in promise handling that prevents the navigation callback from executing after setMoneyRequestParticipantsFromReport completes. This specifically affects the QAB expense creation flow where the code relies on promise resolution to trigger navigation.

  7. removed
    DeployBlockerIndicates it should block deploying the API
    on Mar 6, 2026
  8. mitarachim commented on Mar 6, 2026

    @mitarachim
    Author

    This issue is repro on all PRs in the current deployment checklist. Could you please double check if it's not introduced by #83103 ?

  9. MelvinBot commented on Mar 6, 2026

    @MelvinBot
    Contributor

    Proposal

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

    When a user creates a manual expense in a workspace chat, navigates to Inbox, clicks the FAB (+), selects "Create expense" from the QAB (Quick Action Button), enters an amount, and clicks Next — the app navigates back to the "Create expense" page instead of showing the confirmation page.

    What is the root cause of that problem?

    PR #84317 added iouRequestType to the transaction draft inside startMoneyRequest (src/libs/actions/IOU/index.ts:1378-1381):

    Onyx.set(`...TRANSACTION_DRAFT...`, {
        isFromFloatingActionButton,
        ...(requestType && {iouRequestType: requestType}),  // NEW in #84317
    });

    This causes a chain reaction:

    1. The QAB calls startMoneyRequest(SUBMIT, chatReportID, 'manual', ...) which pre-sets iouRequestType: 'manual' on the draft — but does not set transactionID.
    2. When IOURequestStartPage renders, resetIOUTypeIfChanged (src/pages/iou/request/IOURequestStartPage.tsx:181) checks transaction?.iouRequestType === newIOUType. Since both are 'manual', it returns early and skips initMoneyRequest.
    3. initMoneyRequest is the only function that sets transactionID on the draft transaction. Since it was skipped, transactionID remains undefined.
    4. When the user enters an amount and clicks Next, the app navigates to the confirmation page. The guard useEffect in IOURequestStepConfirmation (src/pages/iou/request/step/IOURequestStepConfirmation.tsx:402-415) checks transaction?.transactionID — finds it undefined — and calls startMoneyRequest() again, which navigates the user back to the "Create expense" page.

    Before PR #84317, iouRequestType was never pre-set in startMoneyRequest, so resetIOUTypeIfChanged would always find a mismatch and properly call initMoneyRequest (which sets transactionID). This is why the bug only appears on staging.

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

    In startMoneyRequest at src/libs/actions/IOU/index.ts:1378, add transactionID: CONST.IOU.OPTIMISTIC_TRANSACTION_ID to the Onyx.set call so the draft transaction is always initialized with a valid transactionID:

    Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`, {
        isFromFloatingActionButton,
        transactionID: CONST.IOU.OPTIMISTIC_TRANSACTION_ID,  // add this
        ...(requestType && {iouRequestType: requestType}),
    });

    This ensures the confirmation page's guard useEffect sees a valid transactionID and does not redirect back, regardless of whether initMoneyRequest is called later.

    What alternative solutions did you explore? (Optional)

    1. Revert the iouRequestType addition from PR [No QA] Sentry logs for Scan shortcut #84317 — This would fix the bug but would break the scan shortcut telemetry that PR [No QA] Sentry logs for Scan shortcut #84317 was designed to support (useScanShortcutSpan needs iouRequestType on the draft to detect scan shortcut flows).
    2. Modify resetIOUTypeIfChanged to also check for transactionID existence — e.g., skip the early return if transaction?.transactionID is missing. This is more defensive but changes the semantics of resetIOUTypeIfChanged and could have broader side effects.

    The recommended fix (adding transactionID to Onyx.set) is the most targeted — it ensures the draft is properly initialized without changing any other behavior.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  10. melvin-bot commented on Mar 6, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  11. fabioh8010 commented on Mar 6, 2026

    @fabioh8010
    Contributor

    It doesn't seem anywhere related to Expensify/react-native-onyx#732, as that PR introduces a change only in SQLite layer that is used by native apps

  12. Julesssss commented on Mar 6, 2026

    @Julesssss
    Contributor

    Verified that this PR introduced the regression.

  13. Julesssss commented on Mar 6, 2026

    @Julesssss
    Contributor

    Fixed on staging 9.3.32-2 already

  14. added a commit that references this issue on Mar 9, 2026
    b4c0755
  15. IuliiaHerets commented on Mar 9, 2026

    @IuliiaHerets

    v9.3.33-1 PR:84552
    Windows 11 / Chrome
    not repro, but I notice the currency in QAB is different from the workspace that recently used

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringHourlyKSv2ReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions