Repository navigation
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
| key={item.transactionID} | ||
| item={item} | ||
| onPress={() => { | ||
| openExpense(item); |
There was a problem hiding this comment.
NAB: openExpense is async now but nothing catches a failure here. Could we add a catch inside it
There was a problem hiding this comment.
Added a try/catch around the sibling read in openExpense: a failed read is logged and the tap does nothing, instead of leaving a rejected promise nobody handles.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
This PR adds a new |
chuckdries
left a comment
There was a problem hiding this comment.
Onyx.multiGet call looks good to me. Haven't reviewed the rest of the PR
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-12-02.at.08.58.21.mov |
| const siblings = await Promise.all( | ||
| transactions.map(async (sibling) => { | ||
| // eslint-disable-next-line rulesdir/no-onyx-get-snapshot-key -- Home is never inside a Search scope, so the rows read live data too | ||
| const [localTransaction, localReport] = await Onyx.multiGet([ |
There was a problem hiding this comment.
Tapping a row now runs a separate Onyx.multiGet for each sibling (up to 5) before navigating. Could we build all the keys up front and read them in a single Onyx.multiGet call?
There was a problem hiding this comment.
Done: the press handler now builds every sibling key up front
There was a problem hiding this comment.
A single call with mixed keys would need unsafe casts to split the results back into transactions and reports, and lint rejects those, so I kept the two typed calls.
| // Narrowed to what the scan can accept, so writes to other reports and expenses don't re-render Home. | ||
| const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {selector: (reports: OnyxCollection<Report>) => pickOwnExpenseReports(reports, currentUserAccountID)}); | ||
| const [allTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION, { | ||
| selector: (transactions: OnyxCollection<Transaction>) => pickTransactionsOnReports(transactions, allReports), |
There was a problem hiding this comment.
Right now the tests add the report and its expenses at the same time. Could we add one where the report shows up later and check that the count goes from 0 to 1?
There was a problem hiding this comment.
Added "should count a flagged expense once its report arrives after the expense and its violation": the expense and its violation are written first (count 0), then only the report lands and the count goes to 1.
Explanation of Change
Home stays mounted while users move around the app, and on a phone a report opened from Home sits on top of it. Several Home sections read whole collections, so any transaction, report or report action write in the account (a server push, a sent message, an opened report) re-rendered them and their rows, even when nothing they show changed.
Each section now reads only the items it can show. Recently Added returns expense IDs plus the Search snapshot's copies, and each row reads its own live transaction and report. The section picks which expenses to list from a narrow selector over the listed and pending transactions, and reads the full siblings with
Onyx.multiGetonly when a row is pressed. For You narrows to the user's open or processing expense reports, their transactions and those transactions' violations before running the same flagged-expense scan. Time Sensitive resolves signer info and card fraud alerts inside selectors, so only the result is compared. Upcoming Travel picks trip rooms only. Every section shows the same thing as before.On web, with Home open and a server-push-style write to a report and a transaction that no section shows, renders per write drop from 129 to 48, render self time from 28.6 to 17.7 ms and total JS time per write by about 13%. Recently Added rows go from 5 re-renders per write to 0. On the iOS simulator, with a report opened from Home and messages sent in it, Home render self time per send drops from about 24 to 18 ms.
Fixed Issues
$ #108551
PROPOSAL:
Tests
Offline tests
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)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
iOS: mWeb Safari
MacOS: Chrome / Safari