Skip to content

[Due for payment 2026-09-22] Invoice - Invoice room shows skeleton loader after sending invoice to phone number #97203

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.4.45-2
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #96441
Email or phone of affected tester (no customers): sdsjodijnsdojsosjio@gmail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Mac 26.5 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Enable Invoices.
  1. Go to staging.new.expensify.com
  2. Open FAB > Send invoice.
  3. Enter amount > Next.
  4. Enter phone number that does not have Expensify account and select the user.
  5. Send the invoice.

Expected Result:

Invoice can be sent to phone number user without issue.

Actual Result:

Invoice room shows skeleton loader after sending invoice to phone number.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7219450_1785220484657.12.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Mita Rachim
Bug ID: 7219450

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. applause-bot commented on Jul 28, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/7358853808e0c95fc1e0cb337c6bca2e56a65551f58e76dd6973e65d82b32be0

  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 28, 2026
  3. MelvinBot commented on Jul 28, 2026

    @MelvinBot
    Contributor

    Proposal

    ⚠️ Likely duplicate: This is almost certainly the same bug as #91557 — "[$250] Web - Invoice - Skeleton loading until refresh page on first time created invoice to the user" (state: Reviewing, already External with a bounty). That issue reports the identical symptom — "Invoice room displays then skeleton loading infinitely until refresh page" when sending an invoice to someone who has never received an invoice before. Picking a phone number with no Expensify account is just one reliable way to hit that "brand-new recipient" path. Recommend closing this as a duplicate of #91557 and consolidating there.

    The analysis below is provided in case it's useful for #91557.

    What is the root cause of that problem?

    Sending an invoice to a recipient who has no existing invoice room creates a brand-new optimistic invoice room (type: CHAT, chatType: INVOICE, reportMetadata.isOptimisticReport: true).

    ReportFetchHandler deliberately skips the openReport() call for optimistic CHAT-type reports that aren't policy expense chats — which is exactly the shape of a new invoice room (ReportFetchHandler.tsx:157). openReport() is the only thing that writes the report loading state and clears isLoadingInitialReportActions. Because it's skipped, that flag keeps its default of true, and the report-actions skeleton gate stays on forever.

    When SendInvoice succeeds and flips isOptimisticReport to false, openReport is never retried, because the effect that triggers fetchReport() does not depend on isOptimisticReport (ReportFetchHandler.tsx:364-370). Only a page refresh remounts the screen — by then the room is no longer optimistic, so openReport finally runs and the skeleton resolves. That's the "until refresh" behavior.

    Existing recipients work because their invoice room already exists in Onyx (not optimistic), so openReport runs normally on first load.

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

    Make ReportFetchHandler re-run openReport once the optimistic invoice room reconciles into a real report. The minimal fix is to add reportMetadata.isOptimisticReport to the fetchReport() effect's dependency array at ReportFetchHandler.tsx:370. The guard still correctly skips openReport while the room is optimistic (server doesn't know it yet), then re-fires once SendInvoice's response flips the flag to false, clearing the skeleton without a refresh.

    What alternative solutions did you explore? (Optional)

    Narrow the skip-guard at ReportFetchHandler.tsx:157 so invoice chat rooms (chatType === INVOICE) aren't treated like plain optimistic chats. This is riskier — an early openReport for a not-yet-persisted room could 404 — so the dependency-array fix is preferred.

    Investigation details & evidence

    Not a regression from the QA-referenced PR (#96441). That PR only swapped formatPhoneNumber from a module import to the useLocalize() context. The two implementations are byte-equivalent (same Onyx COUNTRY_CODE key, same ?? 1 default, neither returns undefined), both live callers pass a defined formatPhoneNumber, and the optimistic-report/navigation logic in SendInvoice.ts was untouched. The bug was found during that PR's QA regression pass, not caused by it — consistent with #91557 predating the PR (reported on v9.3.80-0).

    Why it's not phone-specific: the code distinguishes "existing invoice room" vs "new optimistic room", not phone vs email. A brand-new email recipient with no prior invoice room should reproduce the same skeleton. Phone-number-with-no-account is simply a dependable way to force a new room.

    Supporting code path:

    Ruled out: reportID mismatch (navigated room ID matches the built optimistic room ID) and a DEFAULT_NUMBER_ID fallback (a no-account phone contact still gets a real deterministic optimistic accountID via generateAccountID).


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/97203) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 28, 2026
  5. melvin-bot commented on Jul 28, 2026

    @melvin-bot

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

  6. melvin-bot commented on Jul 28, 2026

    @melvin-bot
  7. ashu75575 commented on Jul 28, 2026

    @ashu75575
    Contributor

    Hey @Krishna2323 — I dug into this and wanted to share findings before posting a full proposal.

    MelvinBot flagged this as a likely duplicate of #91557. The skeleton symptom is similar, but I don’t think we should close this as a duplicate of the selected #91557 proposal. That fix seeds loading state on failure so the error can show. For this issue, the expected result is that the invoice actually sends.

    On staging with a phone that has no Expensify account, SendInvoice returns 666 Invalid invoice receiver. The payload had:

    receiverEmail: +918375810000

    Auth expects:

    +918375810000@expensify.sms

    So the client is sending a raw phone number without @expensify.sms. That fails the request; the optimistic invoice room still opens, and the skeleton sticks because loading state isn’t seeded / openReport never re-runs for that optimistic CHAT room.

    I’d like to post a proposal covering:

    Normalize phone receivers with addSMSDomainIfPhoneNumber
    Seed RAM_ONLY_REPORT_LOADING_STATE for new invoice rooms
    Re-run fetchReport when isOptimisticReport clears
    Okay to post that here?

  8. melvin-bot commented on Jul 31, 2026

    @melvin-bot

    @Krishna2323 Whoops! This issue is 2 days overdue. Let's get this updated quick!

  9. Krishna2323 commented on Aug 3, 2026

    @Krishna2323
    Contributor

    I'll review this tomorrow.

  10. 43 remaining items

  11. melvin-bot commented on Sep 15, 2026

    @melvin-bot

    @Krishna2323

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.78-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-09-22. 🎊

    The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]

  12. melvin-bot commented on Sep 21, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  13. melvin-bot commented on Sep 21, 2026

    @melvin-bot

    Payment Summary

    Resolving PRs:

    Upwork Job

    • Reviewer: @Krishna2323 owed $250 via NewDot
    • Assignee: @ashu75575 requires payment (Needs manual offer from BZ)

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  14. Krishna2323 commented on Sep 22, 2026

    @Krishna2323
    Contributor

    BugZero Checklist:

    Regression Test Proposal

    Precondition:

    Test:

    1. Log in as a workspace admin on staging
    2. Navigate to New Invoice and enter a recipient's phone number (a user with no Expensify account)
    3. Fill in invoice details (amount, merchant, date) and tap Send
    4. Verify the invoice is sent successfully — no "Unexpected error" banner on the invoice room
    5. Verify the invoice room loads correctly without an infinite skeleton

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-b9c8-a727-d012-dd1197875c64
  15. mallenexpensify commented on Sep 24, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @ashu75575 paid $250 via Upwork
    Contributor+: @Krishna2323 due $250 via NewDot

    @ashu75575 can you please accept the job below? Please reply here and tag me once you have.
    https://www.upwork.com/jobs/~022103239518168553480

  16. ashu75575 commented on Sep 25, 2026

    @ashu75575
    Contributor

    @mallenexpensify
    Offer accepted. Thanks !!

  17. mallenexpensify commented on Sep 25, 2026

    @mallenexpensify
    Contributor

    @ashu75575 paid, summary updated above. Thx.

  18. laurenreidexpensify commented on Oct 21, 2026

    @laurenreidexpensify
    Contributor

    Approved @Krishna2323 $250 New Expensify

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

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions