[INP] Use keyed transaction read in receipt modal to speed up Receipt-Image interaction#94097
Draft
MelvinBot wants to merge 1 commit into
Draft
[INP] Use keyed transaction read in receipt modal to speed up Receipt-Image interaction#94097MelvinBot wants to merge 1 commit into
MelvinBot wants to merge 1 commit into
Conversation
Co-authored-by: Chavda Sachin <ChavdaSachin@users.noreply.github.com>
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
The
Receipt-Imageinteraction (tapping a receipt thumbnail to open the receipt modal) is one of the app's slowest INP interactions. TheReceipt-ImageSentry label is emitted by the pressable inReportActionItemImagethat navigates toTRANSACTION_RECEIPT, so this INP measures the time from the tap until the receipt modal mounts and paints.On mount,
TransactionReceiptModalContentcalleduseAllTransactions()and then picked a single transaction out of the result by ID.useAllTransactions()subscribes to the entireONYXKEYS.COLLECTION.TRANSACTIONcollection and, in search context, additionally rebuilds a merged map of every transaction. That is collection-wide synchronous work on the critical path of the interaction, scaling with the user's total transaction count — to render a screen that only needs one transaction record.This PR replaces that broad subscription with a single keyed read:
No manual search fallback is needed:
COLLECTION.TRANSACTIONis inCONST.SEARCH.SNAPSHOT_ONYX_KEYS, so the app'suseOnyxwrapper already resolves a singleTRANSACTIONkey from the active search snapshot. The existing draft / merge-transaction composition in theuseMemois unchanged — it's just sourced from the keyed read. The now-unuseduseAllTransactionsimport is removed.This follows the INP Improvement Workflow guidance to drop redundant / over-broad Onyx subscriptions on interaction paths.
Fixed Issues
$ #85595
PROPOSAL: #85595 (comment)
Tests
Offline tests
Same as Tests.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, 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
iOS: mWeb Safari
MacOS: Chrome / Safari