Repository navigation
Fix initial selected ordering in approver selection lists - #95523
robertjchen merged 19 commits into
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@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] |
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Good for product
|
@linhvovan29546 Could you please review the PR when you get a chance ? thanks |
|
@marufsharifi This change introduces several unnecessary |
@linhvovan29546 Thanks for pointing that out. I first tried the existing pattern, but it didn’t fully handle this flow because the workflow RHP pages can stay mounted between steps. I added focus/scroll handling after that, but I agree it became too workaround-like. I’ve updated it to use |
|
@linhvovan29546, Gentle bump. thanks. |
| const currentFocusedApproverKey = initiallyFocusedOptionKey ?? selectedApproverFocusKey; | ||
| const initialSelectionOptions = {isVisible: allApprovers.length > 0, resetOnFocus: true}; | ||
| const initialSelectedApproverKeys = useInitialSelection(selectedApproverKeys, initialSelectionOptions); | ||
| const initiallyFocusedApproverKey = useInitialSelection(currentFocusedApproverKey, initialSelectionOptions); |
There was a problem hiding this comment.
Why do we need to use useInitialSelection for initiallyFocusedApproverKey? Also, why are there two useInitialSelection hooks here?
|
Bug: The selected item moves when I search Screen.Recording.2026-07-16.at.14.39.07.mov |
|
Bug: The initially selected item is not moved to the top. Screen.Recording.2026-07-16.at.15.17.44.mov |
@linhvovan29546 Sorry for the confusion, but could you please clarify the expected behavior here? In the previous PR #92765 the selected member was not pinned while searching. Should we follow the same behavior here, or should the selected item stay pinned during search too? |
They should stay in the same position and not be reordered. If they are reordered when searching, that's a bug. For example, we already did that in the first PR. Screen.Recording.2026-07-16.at.18.43.06.mov |
|
For context, we've had a long discussion here: #69655 (comment) and throughout the PR: #69655 |
|
@linhvovan29546 Thanks for the clarifications, I will handle that as well. |
|
@linhvovan29546 I have addressed the feedbacks, could you please take another look when you get a chance ? thanks |
|
I'm still reviewing this |
|
@linhvovan29546, Gentle bump. thanks. |
|
|
||
| const isLoadingApprovalWorkflow = isLoadingOnyxValue(approvalWorkflowResults); | ||
| const [selectedMembers, setSelectedMembers] = useState<SelectionListApprover[]>([]); | ||
| const [hasSyncedSelectedMembers, setHasSyncedSelectedMembers] = useState(false); |
There was a problem hiding this comment.
I'm not sure this is the right approach to fix the issue. Maybe we should remove setSelectedMembers and handle selectedMembers the same way we do in other parts of the app?
…improve initial selection handling
|
@linhvovan29546, could you please take another look. thanks. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridApptelegram-cloud-document-5-6278098973831994567.mp4Android: mWeb Chrometelegram-cloud-document-5-6278098973831994568.mp4iOS: HybridAppScreen.Recording.2026-07-25.at.18.10.48.moviOS: mWeb SafariScreen.Recording.2026-07-25.at.17.48.48.movMacOS: Chrome / SafariScreen.Recording.2026-07-25.at.17.09.32.movScreen.Recording.2026-07-25.at.17.08.00.movScreen.Recording.2026-07-25.at.17.25.38.mov |
|
@linhvovan29546 Thanks for the helpful feedback! I've addressed them as well — you can take another look when you get a chance. thanks |
|
🚧 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.45-0 🚀
|
|
🤖 Help site review: no changes required. I reviewed the changes in this PR against the help site articles under This is a purely internal UI/behavior fix in the approver selection lists — it preserves the initially selected item ordering (moving already-selected approvers/members to the top when the selector opens) and prevents the list from reordering mid-selection. It touches None of this changes any documented, user-facing steps:
Because there are no new or changed features, settings, labels, or user-facing flows, no help site documentation update is needed, so I have not created a docs PR. @marufsharifi, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR (Note: no help site PR was created because this change does not require any documentation updates — there is nothing to link. If you believe a specific article should be updated, let me know which one and I'll draft the change.) |
|
🚀 Deployed to production by https://github.com/marcaaron in version: 9.4.45-14 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
This PR follows up on the selected-list-item ordering work from the linked issue.
It updates
ApproverSelectionListso approver/member selectors preserve the initially selected item ordering when opened, without reordering the list again during live selection changes.This covers workflow approval selectors such as:
Fixed Issues
$ #69184
PROPOSAL:#69184 (comment)
Tests
Flow 1: Single approver selectors
Flow 2: Multi-select member selector
13 Verify the initially selected members are still pinned at the top.
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, 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
Flow1
flow11.mov
Flow2
flow22.mov
Android: mWeb Chrome
Flow1
flow1.mp4
Flow2
flow2.mp4
iOS: Native
Flow1
flow01.mov
Flow2
flow02.mov
iOS: mWeb Safari
Flow1
flow011.mov
Flow2
Screen.Recording.2026-07-10.at.7.07.49.PM.mov
MacOS: Chrome / Safari
Flow1
flow1.mov
Flow2
flow2.mov