You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[PAY NOW / CHECKLIST][$250] Report - Infinite loading when creating report offline on workspace for the first time. #72382
Please re-state the problem that we are trying to solve in this issue.
Report previews show infinite loading when creating a report offline on a workspace for the first time, instead of displaying "This report has no expenses".
What is the root cause of that problem?
When a workspace is created, the workspace chat report is created but its metadata is never initialized with hasOnceLoadedReportActions
The MoneyRequestReportPreviewContent component determines whether to show loading based on this condition:
When creating a report offline, the expense report metadata gets properly set, but the parent workspace chat metadata remains uninitialized
This causes hasOnceLoadedReportActions to remain undefined, keeping the loading indicator visible indefinitely
What changes do you think we should make in order to solve the problem?
In Report.ts, update the buildNewReportOptimisticData function here to set hasOnceLoadedReportActions: true for the parent report when adding the report preview action
This ensures the workspace chat metadata is properly initialized when the first report is created
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Verify that when a new report is created on a workspace, the parent workspace chat metadata is set with hasOnceLoadedReportActions: true
test code
it('should set hasOnceLoadedReportActions for parent report metadata when creating a new report',async()=>{constaccountID=1234;constpolicyID='5678';constmockFetchData=fetchasMockFetch;constpolicy={
...createRandomPolicy(Number(policyID)),isPolicyExpenseChatEnabled: true,type: CONST.POLICY.TYPE.TEAM,harvesting: {enabled: false,},};awaitOnyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`,policy);mockFetchData.pause();Report.createNewReport({accountID},true,false,policyID);constparentReport=ReportUtils.getPolicyExpenseChat(accountID,policyID);awaitnewPromise<void>((resolve)=>{constconnection=Onyx.connect({key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${parentReport?.reportID}`,callback: (metadata)=>{if(metadata?.hasOnceLoadedReportActions){Onyx.disconnect(connection);expect(metadata.hasOnceLoadedReportActions).toBe(true);resolve();}},});});});
What alternative solutions did you explore? (Optional)
In this case, it is true because !chatReportMetadata?.hasOnceLoadedReportActions is false.
What changes do you think we should make in order to solve the problem?
When we create a new workspace, the chatReportMetadata?.hasOnceLoadedReportActions should be true for each policy expense chat created.
We can set it to true in:
Please re-state the problem that we are trying to solve in this issue.
When creating a report offline on a workspace for the first time, the report preview in the workspace chat displays an infinite loading spinner instead of showing "This report has no expenses".
What is the root cause of that problem?
The root cause is missing metadata for the parent workspace chat when creating a new IOU report.
The loading logic in MoneyRequestReportPreviewContent.tsx checks:
When creating a report on a new workspace for the first time:
The IOU report's metadata is set with hasOnceLoadedReportActions: true in buildNewReportOptimisticData()
However, the parent workspace chat's metadata is not set at all
This causes chatReportMetadata to be undefined
All three conditions in the loading check evaluate to true, triggering infinite loading
The issue doesn't occur on existing workspaces because those workspace chats already have hasOnceLoadedReportActions: true from previous openReport() calls.
What changes do you think we should make in order to solve the problem?
In src/libs/actions/Report.ts, update the buildNewReportOptimisticData() function to set metadata for the parent workspace chat:
Add this to the optimisticData array (around line 2801):
This ensures the workspace chat is marked as having loaded its actions (even if empty), preventing the loading spinner from showing when transactions are zero.
What alternative solutions did you explore? (Optional)
Alternative 1: Set only hasOnceLoadedReportActions: true without isOptimisticReport: true.
This would work technically, but setting both flags is more consistent with patterns used elsewhere in the codebase (e.g., buildOnyxDataForMoneyRequest() in IOU.ts) and provides better semantic clarity.
📣 @coderyak! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
changed the title [-]Report - Infinite loading when creating report offline on workspace for the first time.[/-][+][$250] Report - Infinite loading when creating report offline on workspace for the first time.[/+]on Oct 13, 2025
changed the title [-][$250] Report - Infinite loading when creating report offline on workspace for the first time.[/-][+][PAY NOW / CHECKLIST][$250] Report - Infinite loading when creating report offline on workspace for the first time.[/+]on Nov 13, 2025
[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: NA. I can't figure out the exact PR that is directly related to this bug. This is an edge case though.
[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: NA
[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.
[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:
Account has no workspaces yet
Test:
Open the Expensify app.
Tap on FAB and create a workspace.
Return to "Inbox"
Turn off internet connection.
Tap on FAB and create a new report.
Tap on the back button on the top left corner to return to "Inbox" again.
Open workspace chat.
Validate that the report preview displays correctly without infinite loading
Activity
melvin-bot commentedon Oct 11, 2025
Triggered auto assignment to @jliexpensify (
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.abzokhattab commentedon Oct 11, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Report previews show infinite loading when creating a report offline on a workspace for the first time, instead of displaying "This report has no expenses".
What is the root cause of that problem?
hasOnceLoadedReportActionsMoneyRequestReportPreviewContentcomponent determines whether to show loading based on this condition:App/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx
Line 118 in fe08aac
hasOnceLoadedReportActionsto remainundefined, keeping the loading indicator visible indefinitelyWhat changes do you think we should make in order to solve the problem?
In
Report.ts, update thebuildNewReportOptimisticDatafunction here to sethasOnceLoadedReportActions: truefor the parent report when adding the report preview actionWhat specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
hasOnceLoadedReportActions: truetest code
What alternative solutions did you explore? (Optional)
NA
paulnjs commentedon Oct 11, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating a report while offline on workspace for the first time, preview of report shows infinite loading.
What is the root cause of that problem?
App/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx
Line 121 in 0400484
!chatReportMetadata?.hasOnceLoadedReportActionsis false.What changes do you think we should make in order to solve the problem?
chatReportMetadata?.hasOnceLoadedReportActionsshould be true for each policy expense chat created.We can set it to true in:
App/src/libs/actions/Policy/Policy.ts
Lines 2156 to 2162 in 0400484
or in success data.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
NA
What alternative solutions did you explore? (Optional)
coderyak commentedon Oct 12, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating a report offline on a workspace for the first time, the report preview in the workspace chat displays an infinite loading spinner instead of showing "This report has no expenses".
What is the root cause of that problem?
The root cause is missing metadata for the parent workspace chat when creating a new IOU report.
The loading logic in
MoneyRequestReportPreviewContent.tsxchecks:When creating a report on a new workspace for the first time:
hasOnceLoadedReportActions: trueinbuildNewReportOptimisticData()chatReportMetadatato beundefinedtrue, triggering infinite loadingThe issue doesn't occur on existing workspaces because those workspace chats already have
hasOnceLoadedReportActions: truefrom previousopenReport()calls.What changes do you think we should make in order to solve the problem?
In
src/libs/actions/Report.ts, update thebuildNewReportOptimisticData()function to set metadata for the parent workspace chat:Add this to the
optimisticDataarray (around line 2801):This ensures the workspace chat is marked as having loaded its actions (even if empty), preventing the loading spinner from showing when transactions are zero.
What alternative solutions did you explore? (Optional)
Alternative 1: Set only
hasOnceLoadedReportActions: truewithoutisOptimisticReport: true.This would work technically, but setting both flags is more consistent with patterns used elsewhere in the codebase (e.g.,
buildOnyxDataForMoneyRequest()in IOU.ts) and provides better semantic clarity.melvin-bot commentedon Oct 12, 2025
📣 @coderyak! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
[-]Report - Infinite loading when creating report offline on workspace for the first time.[/-][+][$250] Report - Infinite loading when creating report offline on workspace for the first time.[/+]melvin-bot commentedon Oct 13, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021977875728430112256
melvin-bot commentedon Oct 13, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eh2077 (
External)25 remaining items
abzokhattab commentedon Oct 30, 2025
PR is ready! #73885
cc @eh2077
abzokhattab commentedon Nov 13, 2025
It looks like the automation failed here.. the PR was merged more than 2 weeks ago
jliexpensify commentedon Nov 13, 2025
Thanks @abzokhattab - looking.
jliexpensify commentedon Nov 13, 2025
Correct, deployed to prod Nov 4th so ready for payment.
@eh2077 checklist please!
[-][$250] Report - Infinite loading when creating report offline on workspace for the first time.[/-][+][PAY NOW / CHECKLIST][$250] Report - Infinite loading when creating report offline on workspace for the first time.[/+]jliexpensify commentedon Nov 13, 2025
Upworks job paid and closed @abzokhattab
jliexpensify commentedon Nov 13, 2025
Payment Summary
Upwork job
jliexpensify commentedon Nov 16, 2025
Bump @eh2077 for checklist plzzzz
eh2077 commentedon Nov 17, 2025
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: NA. I can't figure out the exact PR that is directly related to this bug. This is an edge case though.
[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: NA
[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.
[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:
Test:
Do we agree 👍 or 👎
eh2077 commentedon Nov 17, 2025
@jliexpensify Checklist done, thanks!
garrettmknight commentedon Nov 21, 2025
$250 approved for @eh2077