-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Make CategoryPicker use new SelectionListWithSections
#80623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make CategoryPicker use new SelectionListWithSections
#80623
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@dukenv0307 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d245703a83
ℹ️ 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".
| const categories = policyCategories ?? policyCategoriesDraft ?? {}; | ||
| const validPolicyRecentlyUsedCategories = policyRecentlyUsedCategories?.filter?.((p) => !isEmptyObject(p)); | ||
| const sections = getCategoryListSections({ | ||
| searchValue: debouncedSearchValue, | ||
| selectedOptions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Memoize category sections to keep search debounced
This call now runs on every render, so every searchValue keystroke triggers a full getCategoryListSections recompute (sorting + tree building) even though filtering is based on debouncedSearchValue. That defeats the debounce and can cause noticeable jank for large category lists. Consider restoring a useMemo keyed to debouncedSearchValue, categories, selected options, and localization helpers so the expensive section-building only runs when those inputs actually change.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This component can be compiled by React Compiler so I'd say we should leave the memoization to it
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-01-29.at.11.04.50.movAndroid: mWeb ChromeScreen.Recording.2026-01-29.at.11.01.47.moviOS: HybridAppScreen.Recording.2026-01-29.at.11.04.14.moviOS: mWeb SafariScreen.Recording.2026-01-29.at.10.59.59.movMacOS: Chrome / SafariScreen.Recording.2026-01-29.at.10.58.35.mov |
dukenv0307
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/grgia in version: 9.3.11-16 🚀
|
Explanation of Change
Fixed Issues
$ #65658
PROPOSAL:
Tests
Category(to see text input you should have at least 12 categories to choose from)
Offline tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.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
Screen.Recording.2026-01-27.at.14.47.07.mov