Repository navigation
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@codex review |
|
@Eskalifer1 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3975881f2a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| buildQueryStringFromFilterFormValues({ | ||
| type: CONST.SEARCH.DATA_TYPES.EXPENSE, | ||
| from: [String(accountID)], | ||
| // Without this the server returns its default page (~50 rows), which is wasted payload for a 5 row slot. | ||
| limit: FETCH_LIMIT, | ||
| }), |
There was a problem hiding this comment.
Avoid capping before the insertion-time sort
For users who recently add backdated/imported expenses, this capped query can omit the actual most recently added rows: the parser defaults this Search query to sortBy: date sortOrder: desc, so the server returns only the 15 newest expense dates, and then this hook sorts that already-truncated set by inserted. Any newly inserted expense with an older expense date, or valid row beyond 15 after the client-side filters below, never reaches the widget even though it could have been included in the previous 50-row default page.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed, and it goes further than the ordering mismatch. There is no insertion time sort column in CONST.SEARCH.SORT_BY_COLUMNS, so any server side cap truncates by expense date while this section orders by insertion time. That makes the cap unsafe at any size, not just at 15. I removed the limit rather than raising it, since getting the most recently added rows right matters more than the payload saving. The payload idea comes from the linked issue, so I will note there that it needs an insertion time sort before it can be done safely.
There was a problem hiding this comment.
Yes. The query has no limit parameter now. The slice(0, CONST.HOME.SECTION_VISIBLE_LIMIT) that remains is a display cap on the client-side sorted result, not on what the server returns.
Eskalifer1
left a comment
There was a problem hiding this comment.
When the first search fails and no snapshot was cached (e.g. right after "Reset and refresh"), hasSearchErrors makes isAwaitingFirstResult false and the section renders "No recent expenses" — the exact false claim the linked issue asks to remove ("only show 'No recent expenses' on a genuine first sign-in with no data"), with no retry until Home is refocused. An error/retry state for the error branch would close this - but i think it's out of the scope
There was a problem hiding this comment.
isOffline is now dead in search(): after it stopped being passed to getOnyxLoadingData, the only thing left is forwarding it to search()'s own recursive call, which also does nothing with it. Callers (including the new useRecentlyAddedData) still pass it and read as if search() handled offline.
There was a problem hiding this comment.
You are right, it was dead and I left it that way. Removed the parameter from search() and from every call site. I took it out of the signature first and let the typechecker find the callers, which is also how I caught the ones the upstream merge added, since a text search would have missed them. The offline handling that actually matters stays where it was, in the hook effect that returns early when offline.
|
Let's resolve codex comments and i will do next round of review and I'll do the next round of reviews tonight |
garrettmknight
left a comment
There was a problem hiding this comment.
Looks good from a product perspective.
…d isOffline param
|
All of this round is pushed, plus a sync with main. @Eskalifer1 on the first failed load with nothing cached, you are right that the section still shows "No recent expenses" there, and I agree it is out of scope for this PR. Closing it properly needs an error state with a retry, which means new copy in every language, so it belongs as a follow up on the issue rather than widening this one. Everything else you and Codex raised is done: the reconnect path retries after a failure again, the row cap is gone, One thing worth flagging for whoever reviews the Search side. The reconnect fix broadens when a Search refetches: after a failure, coming back online now retries even when the screen is not focused, where before that only happened with no results cached. It is a read command so nothing is overwritten, and it is what the flag was for, but it is shared behaviour so it should be a deliberate call rather than a surprise. |
|
i updated the comment as well |
Eskalifer1
left a comment
There was a problem hiding this comment.
Those are the only two things I noticed!
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp98969-android-native.movAndroid: mWeb Chrome98969-android-web.moviOS: HybridApp98969-ios-native.moviOS: mWeb Safari98969-ios-web.movMacOS: Chrome / Safari98969-web-1.mov98969-web-2.mov |
|
And let's merge main into branch! |
|
main synced |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e47dbbb5c7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| buildQueryStringFromFilterFormValues({ | ||
| type: CONST.SEARCH.DATA_TYPES.EXPENSE, | ||
| from: [String(accountID)], | ||
| // Without this the server returns its default page (~50 rows), which is wasted payload for a 5 row slot. | ||
| limit: FETCH_LIMIT, | ||
| }), |
|
All feedback is addressed in the latest commits @mountiny |
mountiny
left a comment
There was a problem hiding this comment.
Ok thank you, lets give this one a go
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.60-0 🚀
|
|
🤖 No help site changes required. I reviewed this PR against This is a client-side bug fix for the Recently added section on Home. It (1) shows a loading placeholder while the search resolves instead of a false "No recent expenses" message, and (2) keeps the existing rows on screen when a Search request fails. It adds no new feature, setting, label, or documented behavior. The section is already documented in Expensify-Home-Overview.md, and that article already describes the correct behavior this PR restores:
Since the fix makes the app match what the help site already says (the empty state should only appear when you truly have no expenses), no article is inaccurate. The transient loading placeholder and the error-fallback behavior are internal UI states that help articles don't document. Because no changes are required, I did not open a draft docs PR. |
|
Hi @BartekObudzinski. Steps 5 and 9 are unclear to us. Can the QA team test them? |
|
Hi @IuliiaHerets, both steps use standard Chrome DevTools capabilities: Step 5 — open DevTools, go to Network tab, click the request blocking icon (or right-click any api/Search request and pick “Block request URL”), then add the pattern /api/Search. Step 9 — while the error state is visible, use the Network throttling dropdown in DevTools and switch to “Offline”, then back to “No throttling” to simulate going online. Both work in Chrome. I didn’t find a way to reproduce the problem using the app directly, so DevTools is the only approach I can suggest here |
|
@IuliiaHerets feel free to check this off, Jason did not run into the original bug so that is promising |
|
🚀 Deployed to production by https://github.com/AndrewGable in version: 9.4.60-2 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Home's "Recently added" section was telling users with plenty of expenses that they had none. Two client-side bugs caused this, both fixed here.
First, when a Search request fails while online, the failure path deletes the stored snapshot's data outright, and the section only refetches when Home regains focus or the query changes. A user sitting on Home lost their rows to a single failed request and was shown "no recent expenses" for over half an hour in one production case. The hook now remembers the last snapshot data it rendered, paired with the query hash it was fetched for, and falls back to that copy only while errors are latched. The hash pairing matters because a delegate switch clears Onyx without unmounting Home, so an unkeyed copy could render the previous account's expenses.
Second, the section only had two states: rows, or the empty message. An in-flight or failed search looked identical to a user with no expenses. It now exposes
isAwaitingFirstResultand renders a skeleton until the outcome is settled. Note for reviewers:search.statereachesloadedeven for failures, so the error case is detected fromerrors, not fromstate.The linked issue also suggests capping the query at roughly 5 rows since the section renders at most 5. That is not safely implementable today and is deliberately left out: the parser sends this query as
sortBy: date, so a server-side cap truncates by expense date, while the section orders by insertion time. There is no insertion-time sort column inCONST.SEARCH.SORT_BY_COLUMNS, so a backdated or imported expense added today could be cut before the section ever sorts. Worth tracking separately on the issue.The backend was ruled out during diagnosis: every Search call returned 200 with the expected, byte-identical results.
Note for reviewers: there's a cleaner fix for the first bug that belongs in the Search data layer rather than in this widget. The failure path deletes the snapshot's data even though the error is already recorded separately in
errors. Leaving the data alone would keep the snapshot as the single source of truth and would protect every other Search consumer, not just this widget. It's out of scope here because it changes shared behavior for the Search page itself, which branches on data presence, so it needs sign-off from a Search owner.Fixed Issues
$ #98895
PROPOSAL:
Tests
*/api/Search*in the browser devtools Network tab.Offline tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
Screen.Recording.2026-08-19.at.15.43.48.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-08-19.at.14.42.21.mov