Repository navigation
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@MelvinBot create an issue for this pr and assign me and pr author, link the issue in the fixed issues section of the pr |
|
🤖 Done!
No existing duplicate issue was found for this work. |
…on, stabilize autocomplete suggestions On native the SearchRouter list was deferred until the native-stack push animation ended, so its render ran serially after the ~350ms slide. Mount the list as soon as the skeleton has laid out so the render overlaps the native-driven animation and the list's onLayout (which ends the ManualOpenSearchRouter span) fires ~at animation end instead of ~150ms after it. Also return a stable empty array from useAutocompleteSuggestions on the empty-query path, so the consumer's sections memo stops invalidating on every render and the list no longer re-renders on each parent render. Measured on a settled heavy account (Android, n=8): ManualOpenSearchRouter ~-29% cold / ~-33% warm, SearchRouter.ListRender ~-21%, with much tighter variance (stdev 59 -> 10).
191f588 to
f940abb
Compare
|
|
||
| if (!autocompleteKey) { | ||
| return []; | ||
| return EMPTY_SUGGESTIONS; |
There was a problem hiding this comment.
@sumo-slonik Use CONST.EMPTY_ARRAY as it is standard across codebase.
JmillsExpensify
left a comment
There was a problem hiding this comment.
No product review required on this one.
|
@sumo-slonik Should we add a unit test for this? The existing tests only check |
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp97246_android_native.movAndroid: mWeb Chrome97246_android_web.moviOS: HybridApp97246_ios_native.moviOS: mWeb Safari97246_ios_web.movMacOS: Chrome / Safari97246_web_chrome.mov |
brunovjk
left a comment
There was a problem hiding this comment.
@sumo-slonik Should we add a unit test for this? The existing tests only check toEqual([]), which would still pass if this regressed to returning a new empty array on each render.
We need to confirm whether we need to add a regression test here. Otherwise, LGTM.
Add DeferredSearchAutocompleteListTest for the deferred wrapper: it keeps the skeleton until layout, mounts the list right after the skeleton lays out while a navigation transition is still pending, and falls back to the skeleton once the screen loses focus. Assert in useAutocompleteSuggestions that the empty-query path keeps one array reference across renders and across hook instances, which toEqual([]) could not catch.
00c674d to
f43ad17
Compare
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 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.48-0 🚀
|
|
🤖 No help site changes required. I reviewed the changes in this PR against the help site content under Why: This is a purely internal, native-only performance optimization with no user-facing behavior change:
The only observable outcome is that the SearchRouter opens slightly faster on native. Feature behavior, UI labels, tabs, and workflows are unchanged. The one related article — Use Search Operators to Filter and Analyze — documents that autocomplete suggestions appear when you type after Since no documentation update is warranted, I did not create a draft help site PR. @sumo-slonik, please confirm you agree this change is internal-only and requires no help site updates. If you believe a doc change is warranted, let me know what user-facing behavior changed and I'll draft the PR. |
|
🚀 Deployed to production by https://github.com/arosiclair in version: 9.4.48-3 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Speeds up opening the SearchRouter on native with two small, SearchRouter-local changes.
#95683 and #95378 already reduced the option-list build cost substantially — that build is now a small,
cached part of the open. Building on those gains, this change targets the time that remains, which
profiling traced to two other places:
DeferredSearchAutocompleteList/index.native.tsx.The list was deferred until the native-stack push animation ended, so its render ran serially after the
~350ms slide and the list's
onLayout(which endsManualOpenSearchRouter) fired ~150ms after it. Thepush is native-driven (UI thread), so rendering the list on the JS thread during it does not stutter the
slide. We now mount the list as soon as the skeleton has laid out, overlapping the render with the
animation. Affordable because the option build is already cheap after perf: shrink SearchRouter's initial recent-reports build, paginate on scroll #95683/Speed up SearchRouter open on large accounts #95378.
useAutocompleteSuggestions— the empty-query path returned a fresh[]every render,invalidating the consumer's
sectionsmemo and re-rendering the list on every parent render. It nowreturns a stable empty array, removing those re-render spikes.
Performance (settled heavy account, Android, n=10 per variant in one session, isolating the open from
post-launch churn; every sample verified on the heavy account). The win is on P90 (the production
target), driven by the variance collapse —
main's first-open time is spiky, this PR is flat:Dev-mode on an emulator, so absolute values run higher than production bytecode; the relative P90 delta and
the variance collapse are the signal. The same measurement on iOS trended in the change's favor but the
delta was marginal enough to sit within measurement error, so no iOS result is claimed.
Fixed Issues
$ #97315
PROPOSAL:
Tests
the recent-reports list appears together with the slide, with no visible "pop-in" or animation stutter.
main.from:/to:/in:autocomplete still suggests.Offline tests
Open the router while offline — the list renders from local data exactly as it does online.
QA Steps
Same as Tests (Android + iOS native on staging).
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
iOS: mWeb Safari
MacOS: Chrome / Safari