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
Reports load infinitely after reset app, open Inbox -> Workspace, then open Report #69745
BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors
Version Number: v9.2.1-0 Reproducible in staging?: Yes Reproducible in production?: No If this was caught during regression testing, add the test name, ID and link from TestRail:#66890 Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team Device used: Windows 11 / Chrome. Android 13 / Xiaomi Poco F5, Android 13 / Chrome, macOS 14.5 / MacBook Air 2020 App Component: Other
Action Performed:
Precondition:
At least have a workspace
Login to ND
Submit an expense on the workspace chat
Go to the Reports, reports load fine without issue
Go to Account > Troubleshoot > Clear cache and restart > Reset and refresh
Go to Inbox > Workspace > Reports
Verify that the reports load infinitely
Expected Result:
Reports can be load without any issues
Actual Result:
Reports load infinitely after reset app, open Inbox -> Workspace, then open Report
Note:
Please re-state the problem that we are trying to solve in this issue.
Reports load infinitely after reset app, open Inbox -> Workspace, then open Report
What is the root cause of that problem?
When we reset the app, the snapshot will be deleted from Onyx.
Screen.Recording.2025-09-03.at.22.38.54.mp4
After that, we navigate to Inbox → Workspace → Report tab. At this point, the hook that triggers the search to fetch data does not execute because when we first went to Inbox, the component had already rendered, triggered the call, and returned early. Therefore, when navigating from Inbox → Workspace → Report, the search is not called, and the Search API cannot get the snapshot to set Onyx. This is why the loading spinner remains visible indefinitely
What changes do you think we should make in order to solve the problem?
To resolve this issue, I think we should trigger the Search API call when the snapshot data has been removed, so we can retrieve the snapshot data from the API. We use the flag shouldResetSearchQuery to detect this case
useEffect(() => {
const currentRoute = Navigation.getActiveRouteWithoutParams();
if (hasErrors && (currentRoute === '/' || (shouldResetSearchQuery && currentRoute === '/search'))) {
// Use requestAnimationFrame to safely update navigation params without overriding the current route
requestAnimationFrame(() => {
Navigation.setParams({q: buildCannedSearchQuery()});
});
if (shouldResetSearchQuery) {
setShouldResetSearchQuery(false);
}
} else if (!hasErrors && shouldResetSearchQuery && currentRoute === '/search') {
setShouldResetSearchQuery(false);
handleSearch({queryJSON, searchKey, offset, shouldCalculateTotals});
}
}, [hasErrors, queryJSON, searchResults, shouldResetSearchQuery, setShouldResetSearchQuery, isFocused, handleSearch, searchKey, offset, shouldCalculateTotals]);
Screen.Recording.2025-09-03.at.22.45.02.mov
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
none
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Alternatively, we can add isFocused as a dependency for this hook so that it triggers when the component re-renders. Currently, this hook does not run when switching tabs because the component already rendered on the Inbox tab
Please re-state the problem that we are trying to solve in this issue.
Reports load infinitely after reset app, open Inbox -> Workspace, then open Report
What is the root cause of that problem?
When we clear the cache, all onyx states get removed. Then we don't call the search api again to get the search result and fall into an infinite loading state.
What changes do you think we should make in order to solve the problem?
We should call search when the search page is focused.
BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors
Activity
melvin-bot commentedon Sep 3, 2025
Triggered auto assignment to @flaviadefaria (
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.flaviadefaria commentedon Sep 3, 2025
This feels like an edge case to me, so I am removing the deploy blocker label.
melvin-bot commentedon Sep 3, 2025
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
melvin-bot commentedon Sep 3, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @linhvovan29546 (
External)huult commentedon Sep 3, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Reports load infinitely after reset app, open Inbox -> Workspace, then open Report
What is the root cause of that problem?
When we reset the app, the snapshot will be deleted from Onyx.
Screen.Recording.2025-09-03.at.22.38.54.mp4
After that, we navigate to Inbox → Workspace → Report tab. At this point, the hook that triggers the search to fetch data does not execute because when we first went to Inbox, the component had already rendered, triggered the call, and returned early. Therefore, when navigating from Inbox → Workspace → Report, the search is not called, and the Search API cannot get the snapshot to set Onyx. This is why the loading spinner remains visible indefinitely
App/src/components/Search/index.tsx
Line 331 in fa83fa5
What changes do you think we should make in order to solve the problem?
To resolve this issue, I think we should trigger the Search API call when the snapshot data has been removed, so we can retrieve the snapshot data from the API. We use the flag
shouldResetSearchQueryto detect this caseApp/src/components/Search/index.tsx
Lines 699 to 710 in fa83fa5
update to:
useEffect(() => { const currentRoute = Navigation.getActiveRouteWithoutParams(); if (hasErrors && (currentRoute === '/' || (shouldResetSearchQuery && currentRoute === '/search'))) { // Use requestAnimationFrame to safely update navigation params without overriding the current route requestAnimationFrame(() => { Navigation.setParams({q: buildCannedSearchQuery()}); }); if (shouldResetSearchQuery) { setShouldResetSearchQuery(false); } } else if (!hasErrors && shouldResetSearchQuery && currentRoute === '/search') { setShouldResetSearchQuery(false); handleSearch({queryJSON, searchKey, offset, shouldCalculateTotals}); } }, [hasErrors, queryJSON, searchResults, shouldResetSearchQuery, setShouldResetSearchQuery, isFocused, handleSearch, searchKey, offset, shouldCalculateTotals]);Screen.Recording.2025-09-03.at.22.45.02.mov
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
none
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Alternatively, we can add isFocused as a dependency for this hook so that it triggers when the component re-renders. Currently, this hook does not run when switching tabs because the component already rendered on the Inbox tab
App/src/components/Search/index.tsx
Line 335 in fa83fa5
marufsharifi commentedon Sep 3, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Reports load infinitely after reset app, open Inbox -> Workspace, then open Report
What is the root cause of that problem?
When we clear the cache, all onyx states get removed. Then we don't call the search api again to get the search result and fall into an infinite loading state.
What changes do you think we should make in order to solve the problem?
We should call search when the search page is focused.
App/src/components/Search/index.tsx
Lines 290 to 305 in c46f457
We only need to add
isFocusedto the list of useEffect dependencies.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
None
What alternative solutions did you explore? (Optional)
linhvovan29546 commentedon Sep 6, 2025
I can't reproduce the issue now. It looks like this PR has fixed the problem.
melvin-bot commentedon Sep 9, 2025
@linhvovan29546 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
linhvovan29546 commentedon Sep 10, 2025
not overdue @flaviadefaria Could you please ask re-test?
flaviadefaria commentedon Sep 10, 2025
Asked for a re-test!
m-natarajan commentedon Sep 11, 2025
Issue is not reproducible on Windows 11 / Chrome and Xiaomi Poco F5 / Android 13 in v9.2.9-0 in v9.2.9-0
1000147247.mp4
bandicam.2025-09-11.08-45-51-236.mp4
flaviadefaria commentedon Sep 11, 2025
Thank you @m-natarajan - so closing this.