Repository navigation
Move pre-selected cards to top of list in the spend rule card picker - #100298
Conversation
|
@linhvovan29546 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] |
…g search and update useSearchResults mock for filtering
| const orderedFullListData = moveInitialSelectionToTop(fullListData, initialSelectedCardIDs); | ||
|
|
||
| // Filter the already-pinned list on search (identity sort keeps the pinned order intact). | ||
| const filterCard = (item: ExpensifyCardListItem, searchInput: string) => filterCardsByPersonalDetails(item.card, searchInput, personalDetails); |
There was a problem hiding this comment.
I feel like there might be a mistake here. Before this change, we were using filterCardsByPersonalDetails(card, searchInput, personalDetails). After this change, we’re now using filterCardsByPersonalDetails(item.card, searchInput, personalDetails). I feel like this new change might be incorrect.
There was a problem hiding this comment.
@linhvovan29546 Thanks for flagging this! I think it should be equivalent — item.card is the same original Card we were passing before (each item carries it via the card field in the .map), so filterCardsByPersonalDetails receives the same input. I switched to item.card because I moved moveInitialSelectionToTop to run on the full list before the search filter (it previously ran on the filtered result, which no-ops below STANDARD_LIST_ITEM_LIMIT and drops pinned cards while searching), so useSearchResults now filters items rather than raw cards. Does that reasoning make sense to you, or am I overlooking something here? thanks
There was a problem hiding this comment.
Thinking about this more item.card works, but it reads like a symptom rather than something to settle on. It's only needed because filterCard's input changed from Card to ExpensifyCardListItem in this PR, and filterCardsByPersonalDetails expects the raw Card shape (it reads card.nameValuePairs?.cardTitle directly , etc.., which isn't on item at the top level).
There was a problem hiding this comment.
@linhvovan29546 Ah, sorry I missed this point. I've fixed it by keeping the sort → pin → filter pipeline at the Card level and only mapping to display items at the end, so filterCard now receives a raw Card and there's no more item.card. Could you take another look and share your thoughts? Thanks
trjExpensify
left a comment
There was a problem hiding this comment.
PR is part of a wider clean-up of floating selected items to the top of the list. 👍
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-09-09.at.15.45.15.movAndroid: mWeb ChromeScreen.Recording.2026-09-09.at.15.43.51.moviOS: HybridAppScreen.Recording.2026-09-09.at.15.48.03.moviOS: mWeb SafariScreen.Recording.2026-09-09.at.15.41.49.movMacOS: Chrome / SafariScreen.Recording.2026-09-09.at.15.38.52.mov |
|
🚧 robertjchen 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/robertjchen in version: 9.4.75-0 🚀
|
|
🤖 No help site changes are required for this PR, so I did not create a draft docs PR. Why: this PR only changes the display order of an existing list. Cards already assigned to a Spend rule now float to the top of the card picker instead of sitting in their normal sorted position. It adds no feature, no setting, no new screen, and no new UI label — Articles I checkedThe two articles that document this flow both describe the picker only as a step, and neither states or implies a list order:
Both steps stay accurate after this change. A grep across Adding a line about pinning would also conflict with If this ships alongside a broader change to how pre-selected items behave app-wide (the parent issue #69184 covers many lists), that's still an invisible UX improvement rather than documented behavior — I'd leave the help site as is. @marufsharifi — there's no linked help site PR to review, since I found nothing to update. If you disagree and want an article change anyway, reply with what you'd like documented and I'll open the draft PR. |
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.4.75-3 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.4.75-3 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
This change floats the pre-selected cards to the top of the list when the picker opens, consistent with the "move pre selected items to top" pattern used across the app
Fixed Issues
$ #69184
PROPOSAL: #69184 (comment)
Tests
Offline tests
Same as tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as test
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
Screen.Recording.2026-09-04.at.2.38.26.PM.mov
Android: mWeb Chrome
REC-20260905153500.mp4
iOS: Native
Screen.Recording.2026-09-04.at.2.50.56.PM.mov
iOS: mWeb Safari
Screen.Recording.2026-09-04.at.2.53.19.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2026-09-04.at.2.35.28.PM.mov