[CP Staging] Dedupe approval workflow members#83336
Conversation
|
@youssef-lr 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 |
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
…ctingSubmitter (cherry picked from commit 74e47c6) (cherry-picked to staging by Beamanator)
|
🚧 @dangrous 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! 🧪🧪
|
|
🚀 Cherry-picked to staging by https://github.com/Beamanator in version: 9.3.25-9 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/Beamanator in version: 9.3.25-10 🚀
|
Explanation of Change
PR #82841 changed
convertPolicyEmployeesToApprovalWorkflowsto buildavailableMembersfrom all workspace employees instead of only workflow members. That correctly fixed members in custom workflows not appearing in the "Expenses from" picker.However,
WorkspaceWorkflowsApprovalsEditPagebuilds the approval workflow'savailableMembersby concatenating:Since
defaultWorkflowMembers(now all employees) includes every workflow member, this produced duplicates. For a self-approval workflow (e.g. user A submits to user A), user A appeared twice. Both entries share the samekeyForList(email) in the selection list. When the user deselected a member, duplicate keys caused React/FlashList reconciliation issues, resulting in a blank row.This change deduplicates by filtering
defaultWorkflowMembersto exclude members already in the workflow before concatenating, fixing the blank row while keeping the PR #82841 behavior.Fixed Issues
$ #83251
PROPOSAL: #83251 (comment)
Tests
npm test -- tests/unit/WorkflowUtilsTest.ts— verifymergeWorkflowMembersWithAvailableMembersandconvertPolicyEmployeesToApprovalWorkflowstests passOffline tests
N/A — member list is derived from cached policy data.
QA Steps
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./** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-02-24.at.8.53.54.AM.mov