Migrate ShareTab from useOptionsList to useFilteredOptions#82509
Migrate ShareTab from useOptionsList to useFilteredOptions#82509mountiny merged 14 commits intoExpensify:mainfrom
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
- Extract searchTerm?.trim() check to isSearching boolean constant - Skip sorting in search mode since all reports are returned anyway - Add comment explaining the sort optimization for search case
- Use optionsOrderBy (heap sort) instead of Array.sort for better efficiency - Add reportSortComparator to work with Report objects and privateIsArchivedMap - Heap sort is more efficient when limiting to top N reports
Remove unnecessary effectiveLimit variable and use direct conditional expression for cleaner code
|
@shubham1206agra the failed unit tests aren't related to this PR. I will try to merge main later. |
|
@shubham1206agra 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] |
Since optionsOrderBy already accepts a limit parameter and efficiently returns only the top N items using a heap, the explicit slice operation was unnecessary.
|
🚧 @mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
heyjennahay
left a comment
There was a problem hiding this comment.
Product review not required
|
@shubham1206agra awaiting your review |
|
Can you review this PR? @shubham1206agra |
|
@hoangzinh Yes, I will review this today. Can you please resolve conflicts? |
@shubham1206agra I resolved the conflicts |
Reviewer Checklist
Screenshots/VideosScreen.Recording.2026-03-18.at.6.02.40.PM.mov |
|
@hoangzinh can you please resolve the conflicts? |
|
🚧 @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.3.41-0 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.3.41-4 🚀
|
Explanation of Change
This PR migrates ShareTab from
useOptionsListtouseFilteredOptionsand enhancescreateFilteredOptionListto properly handle search mode.Key Changes:
ShareTab Migration
useOptionsListwithuseFilteredOptionshookSearch Mode Optimization
maxRecentReportslimitHeap Sort Implementation
Array.sort()with heap sort for better efficiency when limiting to top N reports => Reduced from384msto333mswithmaxRecentReportsvalue is 500Fixed Issues
$ #82181
PROPOSAL:
Tests
Same as QA
Offline tests
Same as QA
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Native apps only:
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
Screen.Recording.2026-03-07.at.06.05.58.mov
Android: mWeb Chrome
iOS: Native
Screen.Recording.2026-03-07.at.06.12.03.mov
iOS: mWeb Safari
MacOS: Chrome / Safari