Skip to content

[Due for payment 2025-11-12] [$250] Expense - Report view turns to skeleton loader after paying IOU expense via workspace offline #72411

Closed

Description

@lanitochka17

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.29-1
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://test-management.browserstack.com/projects/2219752/test-runs/TR-1235/folder/13177049/41237817/945415338
Email or phone of affected tester (no customers): applausetester+101001kh@applause.expensifail.com
Issue reported by: Applause - Internal Team

Action Performed:

Precondition:

  • User A default currency is USD
  • User B has a workspace
  1. Go to staging.new.expensify.com
  2. [User A] Submit an IOU expense to User B
  3. [User B] Open the IOU report
  4. [User B] Go offline
  5. {User B] Click Pay > Pay via workspace
  6. [User B] Close the RHP

Expected Result:

Report view will not turn to skeleton loader

Actual Result:

Report view turns to skeleton loader after paying IOU expense via workspace offline

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop
Platforms Tested: On which of our officially supported platforms was this issue tested:
  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6972348_1760215823398.offline.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021978695300058866413
  • Upwork Job ID: 1978695300058866413
  • Last Price Increase: 2025-10-23
Issue OwnerCurrent Issue Owner: @deetergp

Activity

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

    @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. mukhrr commented on Oct 12, 2025

    @mukhrr
    Contributor

    Proposal

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

    When User B pays an IOU expense via workspace while offline and then closes the payment RHP, the report view incorrectly displays a skeleton loader instead of showing the optimistic payment data

    What is the root cause of that problem?

    We are missing offline check in the skeleton loader condition at MoneyRequestReportView.tsx:

    if (isLoadingApp) {
    return (
    <View style={styles.flex1}>
    <HeaderGap />
    <ReportHeaderSkeletonView />
    <ReportActionsSkeletonView />
    {shouldDisplayReportFooter ? (
    <ReportFooter
    report={report}
    reportMetadata={reportMetadata}
    policy={policy}
    pendingAction={reportPendingAction}
    isComposerFullSize={!!isComposerFullSize}
    lastReportAction={lastReportAction}
    // If the report is from the 'Send Money' flow, we add the comment to the `iou` report because for these we don't combine reportActions even if there is a single transaction (they always have a single transaction)
    transactionThreadReportID={isSentMoneyReport ? undefined : transactionThreadReportID}
    />
    ) : null}
    </View>
    );
    }

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

    We should check again isOffline too.

    if (isLoadingApp && !isOffline) {
      // existing skeleton loading logic
    }

    We already do the same in codebase

    // Show skeleton while the app is loading and we're online
    const shouldShowSkeletonForAppLoad = isLoadingApp && !isOffline;
    if (shouldShowSkeletonForInitialLoad ?? shouldShowSkeletonForAppLoad) {
    return <ReportActionsSkeletonView />;
    }

    const shouldShowLoadingIndicator = isLoadingApp && !isOffline;

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

  4. Tony-MK commented on Oct 12, 2025

    @Tony-MK
    Contributor

    Proposal

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

    Report view turns to skeleton loader after paying IOU expense via workspace offline

    What is the root cause of that problem?

    In MoneyRequestReportView, the app shows the skeleton view instead of the MoneyRequestReportActionsList because it is loading, and the condition is met.

    if (isLoadingApp) {
    return (

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

    We should change the condition to check if the report's pending action is not available.

    if (isLoadingApp && !reportPendingAction) {
        return (
    Screen.Recording.2025-10-12.at.22.11.09.mov
  5. paulnjs commented on Oct 12, 2025

    @paulnjs
    Contributor

    Proposal

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

    • Expense - Report view turns to skeleton loader after paying IOU expense via workspace offline

    What is the root cause of that problem?

    • When User B selects Pay > Pay via workspace, the following logic is triggered:

    const inviteResult = moveIOUReportToPolicyAndInviteSubmitter(iouReport?.reportID, adminPolicy, formatPhoneNumber);
    if (inviteResult?.policyExpenseChatReportID) {
    Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(inviteResult.policyExpenseChatReportID));
    } else {

    • This calls:

    function moveIOUReportToPolicyAndInviteSubmitter(

    • Inside this function, we optimistically create a policy expense chat report:

    const policyExpenseChats = createPolicyExpenseChats(policyID, invitedEmailsToAccountIDs);

    • This is the same report we try to open immediately after:

    Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(inviteResult.policyExpenseChatReportID));

    • However, the navigation occurs too soon—before the optimistic report is fully merged into Onyx. This causes the subsequent navigation call to fetch a partially built report with only {reportName: Chat Report}:

    const optimisticReport = reportActionsExist(reportID)

    • As a result, the app navigates to a report that lacks complete data, which leads to an infinite loading skeleton.

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

    • We need to ensure that Onyx has successfully merged the optimistic report data before navigating to it.
    • This can be achieved by deferring the navigation using the setNavigationActionToMicrotaskQueue utility, which waits until the next microtask before executing the navigation. Example:

    if (inviteResult?.policyExpenseChatReportID) {
    Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(inviteResult.policyExpenseChatReportID));
    } else {
    const moveResult = moveIOUReportToPolicy(iouReport?.reportID, adminPolicy, true);
    savePreferredPaymentMethod(iouReport.policyID, adminPolicy.id, CONST.LAST_PAYMENT_METHOD.IOU, lastPaymentMethod?.[adminPolicy.id]);
    if (moveResult?.policyExpenseChatReportID && !moveResult.useTemporaryOptimisticExpenseChatReportID) {
    Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(moveResult.policyExpenseChatReportID));
    }
    }
    if (adminPolicy?.achAccount) {
    return;
    }
    Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute(adminPolicy.id));
    return;

    
    if (inviteResult?.policyExpenseChatReportID) {
        setNavigationActionToMicrotaskQueue(() => {
            Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(inviteResult.policyExpenseChatReportID));
            if (adminPolicy?.achAccount) {
                return;
            }
            Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute(adminPolicy.id));
        });
    } else {
        const moveResult = moveIOUReportToPolicy(iouReport?.reportID, adminPolicy, true);
        savePreferredPaymentMethod(iouReport.policyID, adminPolicy.id, CONST.LAST_PAYMENT_METHOD.IOU, lastPaymentMethod?.[adminPolicy.id]);
    
        if (moveResult?.policyExpenseChatReportID && !moveResult.useTemporaryOptimisticExpenseChatReportID) {
            setNavigationActionToMicrotaskQueue(() => {
                Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(moveResult.policyExpenseChatReportID));
                if (adminPolicy?.achAccount) {
                    return;
                }
                Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute(adminPolicy.id));
            });
        }
    }
    
    • We should apply this pattern in other similar areas where premature navigation could lead to broken or partial views—especially when dealing with optimistic data.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

    None

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 16, 2025
  7. changed the title [-]Expense - Report view turns to skeleton loader after paying IOU expense via workspace offline[/-] [+][$250] Expense - Report view turns to skeleton loader after paying IOU expense via workspace offline[/+] on Oct 16, 2025
  8. melvin-bot commented on Oct 16, 2025

    @melvin-bot
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 16, 2025
  10. melvin-bot commented on Oct 16, 2025

    @melvin-bot

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

  11. 25 remaining items

  12. melvin-bot commented on Nov 10, 2025

    @melvin-bot

    Triggered auto assignment to @trjExpensify (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.

  13. stephanieelliott commented on Nov 10, 2025

    @stephanieelliott
    Contributor

    Adding the Bug label to reassign this as I am going on leave til Dec 1.
    Status: this just needs to be paid on 11/12! Also:

    when payment time comes, @ishpaul777 should be paid via NewDot (even if an suto-post says otherwise)

  14. trjExpensify commented on Nov 12, 2025

    @trjExpensify
    Contributor

    👋 Checklist time, @ishpaul777.

  15. melvin-bot commented on Nov 12, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@trjExpensify)

    • (if NewFeature) I have created a PR for any necessary HelpDot updates, or I confirmed no updates are necessary.
    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1978695300058866413/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  16. trjExpensify commented on Nov 17, 2025

    @trjExpensify
    Contributor

    Bump on the checklist, @ishpaul777.

  17. ishpaul777 commented on Nov 18, 2025

    @ishpaul777
    Contributor

    sorry missed it! will fill out soon today

  18. ishpaul777 commented on Nov 19, 2025

    @ishpaul777
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: https://github.com/Expensify/App/pull/66790/files#r2541856531

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: No need

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again. - yes

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Precondition:

    Precondition:

    • User A default currency is USD
    • User B has a workspace

    Test:

    1. Go to staging.new.expensify.com
    2. [User A] Submit an IOU expense to User B
    3. [User B] Open the IOU report
    4. [User B] Go offline
    5. {User B] Click Pay > Pay via workspace
    6. [User B] Close the RHP, verify Report view will not turn to into infinite skeleton loader

    Do we agree 👍 or 👎

  19. trjExpensify commented on Nov 19, 2025

    @trjExpensify
    Contributor

    Thanks!

    Payment summary as follows:

    • $250 to @ishpaul777 for C+ (go ahead and request)
    • $250 to @paulnjs for the PR (needed to apply)

    @paulnjs please send me your Upwork profile.

  20. paulnjs commented on Nov 20, 2025

    @paulnjs
    Contributor
  21. trjExpensify commented on Nov 21, 2025

    @trjExpensify
    Contributor

    Thanks, offer sent.

  22. paulnjs commented on Nov 22, 2025

    @paulnjs
    Contributor

    @trjExpensify I accepted the offer. Thank you!

  23. trjExpensify commented on Nov 24, 2025

    @trjExpensify
    Contributor

    Paid, closing!

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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions