Repository navigation
perf: make Search rows read their own focus - #104734
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@hoangzinh 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] |
Codex Review SummaryThis 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. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeScreen.Recording.2026-10-23.at.18.26.33.moviOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-10-23.at.18.23.27.mov |
|
|
||
| const renderItemWithKeyboardFocus = ({item, index}: {item: SearchListItem; index: number}) => { | ||
| const isItemFocused = focusedIndex === index; | ||
| return renderItem(item, index, isItemFocused, getOnFocus(index)); |
There was a problem hiding this comment.
hey @TMisiukiewicz, previously, this focus flag was local state of one BaseSearchList. Now it lives in a global Onyx key that only contains the row key:
Onyx.set(${ONYXKEYS.COLLECTION.RAM_ONLY_SEARCH_ROW_FOCUS}${keyForList}, ...)
Do you think it will cause any collisions UI?
There was a problem hiding this comment.
I don't think so, because only one SearchFullscreenNavigator renders only from the last SEARCH.ROOT onward, so older search screens unmount, which makes only one BaseSearchList mounted at a time
There was a problem hiding this comment.
I tried to find a bug with this, but I couldn't. Hmm, let's keep it as it is for now.
|
@TMisiukiewicz when you say "Open Search > Expenses" in Test, do you mean "Open Spend -> Expenses"? |
|
@hoangzinh yes 👍 |
|
@TMisiukiewicz do you mind correcting it? So it won't confuse QA team when they start to test this PR |
|
done! |
|
🚧 rlinoz 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/rlinoz in version: 9.5.20-0 🚀
|
|
No help site update needed. This PR is a performance refactor: it changes how Search rows track keyboard focus internally, and users see the same focus highlight and behavior as before. |
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.5.20-5 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Moving keyboard focus in a Search list (arrow keys on web) used to re-render every visible row.
BaseSearchListpassedisFocusedintorenderItemand putfocusedIndexin FlashList'sextraData, so every focus change invalidated every cell.Now
BaseSearchListwrites the focused row'skeyForListto a new RAM-only Onyx collection (RAM_ONLY_SEARCH_ROW_FOCUS). Each row reads its own flag throughuseIsSearchRowFocused(keyForList). Moving focus re-renders only the row that lost focus and the row that gained it.focusedIndexis removed fromextraData, andisFocusedis removed from therenderItemsignature and the row props.Fixed Issues
$ #104742
PROPOSAL:
Tests
Offline tests
Same as tests. Focus state is local and RAM-only.
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
iOS: mWeb Safari
MacOS: Chrome / Safari