Skip to content

[PAY][$250] Multi scan - After replacing receipt, other receipt disappears, or confirm page becomes broken #79324

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: 9.2.99-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #69326
Email or phone of affected tester (no customers): sdjkdsnsndoisjoidsjdoi@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.1 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Click + > Create expense > Scan.
  4. Upload two receipts.
  5. On confirm page, click on the receipt.
  6. Click 3-dot menu > Replace.
  7. Replace the receipt.
    BUG 1: The second receipt disappears after replacing the first receipt.
  8. Close the RHP.
  9. Click + > Create expense > Scan.
  10. Upload two receipts.
  11. On confirm page, click next arrow on the top right to navigate to the second receipt.
  12. Click on the receipt.
  13. Click 3-dot menu > Replace.
  14. Replace the receipt.
    BUG 2: To field disappears. Amount field changes to 0.00.

Expected Result:

BUG 1: After replacing the first receipt, the second receipt should remain unaffected.
BUG 2: After replacing the second receipt, To field will not disappear. Amount field will not show up because this is a scan expense.

Actual Result:

BUG 1: The second receipt disappears after replacing the first receipt.
BUG 2: After replacing the second receipt, To field disappears, Amount field changes to 0.00.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7045963_1768150536081.1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022010878582663122873
  • Upwork Job ID: 2010878582663122873
  • Last Price Increase: 2026-01-13
Issue OwnerCurrent Issue Owner: @RachCHopkins

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 12, 2026
  2. melvin-bot commented on Jan 12, 2026

    @melvin-bot

    Triggered auto assignment to @RachCHopkins (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. bernhardoj commented on Jan 12, 2026

    @bernhardoj
    Contributor

    Proposal

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

    What is the root cause of that problem?

    When we edit the receipt, if the multi scan is not enabled, then it will clear all the previous drafts before setting a new one.

    if (!isMultiScanEnabled) {
    removeDraftTransactions(true);
    }
    for (const [index, file] of files.entries()) {
    const source = URL.createObjectURL(file as Blob);
    const transaction = shouldReuseInitialTransaction(initialTransaction, shouldAcceptMultipleFiles, index, isMultiScanEnabled, transactions)
    ? (initialTransaction as Partial<Transaction>)
    : buildOptimisticTransactionAndCreateDraft({
    initialTransaction: initialTransaction as Partial<Transaction>,
    currentUserPersonalDetails,
    reportID,
    });
    const transactionID = transaction.transactionID ?? initialTransactionID;
    newReceiptFiles.push({file, source, transactionID});
    setMoneyRequestReceipt(transactionID, source, file.name ?? '', true, file.type);
    }

    On the start page, we pass the props based on the transaction drafts length.

    <IOURequestStepScan
    route={route}
    navigation={navigation}
    onLayout={(setTestReceiptAndNavigate) => {
    setTestReceiptAndNavigateRef.current = setTestReceiptAndNavigate;
    }}
    isMultiScanEnabled={isMultiScanEnabled}
    setIsMultiScanEnabled={setIsMultiScanEnabled}

    const [optimisticTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, {
    selector: transactionDraftValuesSelector,
    canBeMissing: true,
    });
    const [isMultiScanEnabled, setIsMultiScanEnabled] = useState((optimisticTransactions ?? []).length > 1);

    But when editing, the scan page is in its own screen, so no props are passed, thus isMultiScanEnabled is false. We probably hold the state in the start page component because we need to clear the state when the tab changes.

    const resetIOUTypeIfChanged = useCallback(
    (newIOUType: IOURequestType) => {
    Keyboard.dismiss();
    if (transaction?.iouRequestType === newIOUType) {
    return;
    }
    setIsMultiScanEnabled(false);

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

    We need to check if isStartingScan is true here too which indicates that this is from the start page.

    if (!isMultiScanEnabled) {
    removeDraftTransactions(true);
    }

    What alternative solutions did you explore? (Optional)

    We need to move the state down to the scan page, both index and index.native files, so we won't need to pass down the props anymore.

    Then we can remove setIsMultiScanEnabled call here,

    const resetIOUTypeIfChanged = useCallback(
    (newIOUType: IOURequestType) => {
    Keyboard.dismiss();
    if (transaction?.iouRequestType === newIOUType) {
    return;
    }
    setIsMultiScanEnabled(false);
    initMoneyRequest({

    And to disable the multi scan when switching tabs, we can forward a ref and expose the set state function.

    scanPageRef.current.setIsMultiScanEnabled(false);
  4. RachCHopkins commented on Jan 13, 2026

    @RachCHopkins
    Contributor

    Can repro perfectly on Safari - great repro steps thank you @mitarachim !!

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jan 13, 2026
  6. changed the title [-]Multi scan - After replacing receipt, other receipt disappears, or confirm page becomes broken[/-] [+][$250] Multi scan - After replacing receipt, other receipt disappears, or confirm page becomes broken[/+] on Jan 13, 2026
  7. melvin-bot commented on Jan 13, 2026

    @melvin-bot
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 13, 2026
  9. melvin-bot commented on Jan 13, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @truph01 (External)

  10. yatin-italy commented on Jan 13, 2026

    @yatin-italy

    Proposal

    Restate the problem this issue is trying to solve.
    Replacing a receipt from the scan screen clears sibling drafts and rebuilds the draft for the replaced receipt, wiping To/Amount. This happens because the scan screen defaults to single-scan when opened alone.

    What is the root cause of that problem?
    isMultiScanEnabled is lost when the scan page mounts standalone. It defaults to false, which triggers removeDraftTransactions(true) and rebuilds a new optimistic transaction instead of using the existing draft.

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

    • Add a local state to hydrate isMultiScanEnabled from existing drafts:
    const [isMultiScanEnabledLocal, setIsMultiScanEnabledLocal] = useState(isMultiScanEnabled);
    • Update local state if multiple transactions exist:
    useEffect(() => {
        if (!isMultiScanEnabledLocal && (transactions?.length ?? 0) > 1) {
            setIsMultiScanEnabledLocal(true);
        }
    }, [transactions, isMultiScanEnabledLocal]);
    • Only clear drafts if truly in single-scan mode:
    if (!isMultiScanEnabledLocal) {
        removeDraftTransactions(true);
    }
    • When replacing files, reuse existing drafts to preserve To/Amount:
    const existingDraft = transactions?.[index];
    const transaction = shouldReuseInitialTransaction(
        initialTransaction,
        shouldAcceptMultipleFiles,
        index,
        isMultiScanEnabledLocal,
        transactions
    )
        ? (existingDraft ?? initialTransaction ?? {})
        : buildOptimisticTransactionAndCreateDraft({
              initialTransaction: initialTransaction as Partial<Transaction>,
              currentUserPersonalDetails,
              reportID,
          });

    What alternative solutions did you explore? (Optional)
    None

  11. added a commit that references this issue on Jan 16, 2026
    3b18017
  12. 18 remaining items

  13. melvin-bot commented on Feb 13, 2026

    @melvin-bot

    This issue has not been updated in over 15 days. @RachCHopkins, @roryabraham, @bernhardoj, @truph01 eroding to Monthly issue.

    P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

  14. changed the title [-][$250] Multi scan - After replacing receipt, other receipt disappears, or confirm page becomes broken[/-] [+][PAY][$250] Multi scan - After replacing receipt, other receipt disappears, or confirm page becomes broken[/+] on Feb 13, 2026
  15. roryabraham commented on Feb 13, 2026

    @roryabraham
    Contributor

    @RachCHopkins payment breakdown:

  16. RachCHopkins commented on Feb 19, 2026

    @RachCHopkins
    Contributor

    Payment Summary:

    • Contributor: @bernhardoj to be paid $250 via NewDot Manual Request
    • Contributor+: @truph01 to be paid $250 via NewDot Manual Request

    Upwork job here

  17. RachCHopkins commented on Feb 19, 2026

    @RachCHopkins
    Contributor

    The Upwork post has been closed. 🟢 to @bernhardoj and @truph01 to request payment via NewDot.

  18. bernhardoj commented on Feb 19, 2026

    @bernhardoj
    Contributor

    Requested in ND.

  19. garrettmknight commented on Feb 20, 2026

    @garrettmknight
    Contributor

    $250 approved for @bernhardoj

  20. JmillsExpensify commented on Apr 5, 2026

    @JmillsExpensify
    Contributor

    $250 approved for @truph01

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions