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
[Due for payment 2026-09-01] Home "Recently added" widget shows "No recent expenses" when the Search request fails or is still in flight #98895
On the Home page, the "Recently added" section can incorrectly show "No recent expenses" even when the user has plenty of expenses locally. Two distinct triggers were found while diagnosing a report from @JmillsExpensify:
Failed in-flight Search wipes the section and it never recovers. If the Search request backing that section fails while in flight, the failure handling clears the stored results and leaves an error marker in their place. The section only refetches when Home regains focus or when the query changes — so if the user is already sitting on Home, it stays empty indefinitely (observed for 30+ minutes). Because the section only has two visible states (rows or the empty message), the error reads as "No recent expenses" rather than as a failure.
No loading state during a slow Search makes Home claim you have no expenses. The query has no date bound, so the server sorts every accessible transaction before cutting to ~51 results, which can take 5+ seconds. Home fires ~6 of these in parallel and waits for the slowest (worst case ~7s in Sentry). With no loading state, Home shows "No recent expenses" for that entire window.
Backend was ruled out — every Search call returned 200 with the expected results; this is a frontend state/UX issue.
Proposed changes
Never show the empty state when local data exists. The widget should fall back to existing local expense data while a Search is running or has failed, and only show "No recent expenses" on a genuine first sign-in with no data.
Add a loading state so Home doesn't assert "no expenses" while Search is still in flight.
Reduce the payload — the widget only renders 5 rows, so the Search should request ~5 transactions instead of 51 to shrink the payload (may not speed up the query much, but avoids the unnecessary transfer).
changed the title [-]Home "Recently added" widget shows "No recent expenses" when the Search request fails or is still in flight[/-][+][Due for payment 2026-09-01] Home "Recently added" widget shows "No recent expenses" when the Search request fails or is still in flight[/+]on Aug 25, 2026
Offending PR: #93451 — [Home Page] Add Recently added slot to Home
Merged 2026-06-19 by adamgrzybowski. It introduced the Recently added slot with only two render states — rows or "No recent expenses" — while sourcing its data from an async Search snapshot. Every "no expenses" symptom in this issue comes from that gap, so both root causes trace back here.
Root cause 1 — failed Search wipes the section. The slot rendered index.tsx:145-183 as hasExpenses ? rows : <EmptyState />, and only refetched on focus or hash change (useRecentlyAddedData.ts:101-106). A single failed request therefore emptied it indefinitely.
Root cause 2 — no loading state. Same two-state render: an in-flight Search was indistinguishable from having no expenses.
Why the Search data layer is not the offending PR
The Search failure path deletes the snapshot's data at Search.ts:820. That behavior predates this issue by ~18 months — it was added in #54007 (2024-12-20) so the Search page would show its empty view on error, and later hardened to data: null in #82255. It was correct for its only consumer at the time and caused no user-visible bug on its own.
#93451 made a second consumer depend on that snapshot without accounting for the wipe or for the in-flight window. That is where the reported regression enters production, so it is the PR to attribute.
git log -L on the failure block confirms the ordering:
Fixed in #98969, which added isAwaitingFirstResult plus a skeleton (index.tsx:131) and stopped deleting data on failure in getOnyxLoadingData.
💡 Suggested AI code review rule
This looks like a recurring, mechanically detectable pattern, so it may be worth a coding-standards rule. Proposed for Expensify/App:
Rule:UI-4 Do not render an empty state from async data without a settled signal
Condition: A component renders an empty/zero state gated only on data.length (or isEmptyObject(data)) while that data comes from an async source such as a Search snapshot or a request-backed useOnyx key. Require an explicit "the outcome is settled" flag and render a skeleton until then; never let in-flight or failed resolve to the same UI as genuinely empty.
Why: Loading and error collapse into "you have nothing", so the app confidently asserts a falsehood about the user's data. That is what produced this issue — users with plenty of expenses were shown "No recent expenses" for 30+ minutes.
Search pattern:grep -rnE '(\.length (>|===) 0|isEmptyObject\()[^\n]*\?' src/ on files that also match SNAPSHOT|useOnyx, then check for a loading/settled branch.
No existing rule covers this — UI-1 is about which loading indicator to use, not about missing one. If it's worth adding, a maintainer can open it as a draft PR in Expensify/App.
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
[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: N/A
[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.
Regression Test Proposal
Precondition:
Sign in to an account that has several expenses.
Test:
Go to Settings > Troubleshoot and tap Reset and refresh, then open Home.
Verify the Recently added section shows a shimmer placeholder first and then the real rows
Let the section fill, then toggle on Simulate failing network requests
Leave Home (for example open Search) and come back, which forces a refetch that now fails.
Activity
melvin-bot commentedon Aug 19, 2026
@mountiny — to hire @Eskalifer1 on Upwork, add the External label so a job is created and the offer is sent automatically.
[-]Home "Recently added" widget shows "No recent expenses" when the Search request fails or is still in flight[/-][+][Due for payment 2026-09-01] Home "Recently added" widget shows "No recent expenses" when the Search request fails or is still in flight[/+]3 remaining items
Eskalifer1 commentedon Aug 31, 2026
@MelvinBot find offending PR for this issue based on changes from PR
MelvinBot commentedon Aug 31, 2026
Offending PR: #93451 — [Home Page] Add Recently added slot to Home
Merged 2026-06-19 by
adamgrzybowski. It introduced the Recently added slot with only two render states — rows or "No recent expenses" — while sourcing its data from an async Search snapshot. Every "no expenses" symptom in this issue comes from that gap, so both root causes trace back here.Root cause 1 — failed Search wipes the section. The slot rendered
index.tsx:145-183ashasExpenses ? rows : <EmptyState />, and only refetched on focus or hash change (useRecentlyAddedData.ts:101-106). A single failed request therefore emptied it indefinitely.Root cause 2 — no loading state. Same two-state render: an in-flight Search was indistinguishable from having no expenses.
Why the Search data layer is not the offending PR
The Search failure path deletes the snapshot's
dataatSearch.ts:820. That behavior predates this issue by ~18 months — it was added in #54007 (2024-12-20) so the Search page would show its empty view on error, and later hardened todata: nullin #82255. It was correct for its only consumer at the time and caused no user-visible bug on its own.#93451 made a second consumer depend on that snapshot without accounting for the wipe or for the in-flight window. That is where the reported regression enters production, so it is the PR to attribute.
git log -Lon the failure block confirms the ordering:Fixed in #98969, which added
isAwaitingFirstResultplus a skeleton (index.tsx:131) and stopped deletingdataon failure ingetOnyxLoadingData.💡 Suggested AI code review rule
This looks like a recurring, mechanically detectable pattern, so it may be worth a coding-standards rule. Proposed for
Expensify/App:UI-4Do not render an empty state from async data without a settled signaldata.length(orisEmptyObject(data)) while that data comes from an async source such as a Search snapshot or a request-backeduseOnyxkey. Require an explicit "the outcome is settled" flag and render a skeleton until then; never let in-flight or failed resolve to the same UI as genuinely empty.grep -rnE '(\.length (>|===) 0|isEmptyObject\()[^\n]*\?' src/on files that also matchSNAPSHOT|useOnyx, then check for a loading/settled branch.index.tsx:145-183index.tsx:131No existing rule covers this —
UI-1is about which loading indicator to use, not about missing one. If it's worth adding, a maintainer can open it as a draft PR inExpensify/App.view run
Eskalifer1 commentedon Aug 31, 2026
Contributor+ Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: [Home Page] Add Recently added slot to Home #93451 (comment)
[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: N/A
[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.
Regression Test Proposal
Precondition:
Test:
Simulate failing network requestsDo we agree 👍 or 👎
melvin-bot commentedon Aug 31, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Aug 31, 2026
Payment Summary
Resolving PRs:
fix: Recently added section shows false empty state on Home #98969
Contributor: @BartekObudzinski does not require payment (Contractor)
Assignee: @Eskalifer1 requires payment (Needs manual offer from BZ)
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Sep 3, 2026
Payment Summary
Contributor+: @Eskalifer1 paid $250 via Upwork.
@Eskalifer1 can you please accept the job below? Please reply here and tag me once you have.
https://www.upwork.com/jobs/~022095584032299760681
Eskalifer1 commentedon Sep 3, 2026
Hi @mallenexpensify, i have accepted, thank you!
mallenexpensify commentedon Sep 3, 2026
@Eskalifer1 paid, summary updated above. Thx.