feat: [CFI] Add an exposed filter for workspace when a user is a member of several workspaces#75638
Conversation
| @@ -615,6 +661,14 @@ function SearchFiltersBar({ | |||
| hasMultipleOutputCurrency, | |||
| has, | |||
| is, | |||
| workspaces, | |||
There was a problem hiding this comment.
❌ PERF-6
Including workspaces as a dependency causes this useMemo to re-execute whenever the workspace list changes in any way (order, icons, selection state, etc.), even when only workspaceCount and shouldDisplayWorkspaceFilter are actually used from it.
Suggested fix: Remove workspaces from the dependency array since workspaceCount and shouldDisplayWorkspaceFilter (which are derived from workspaces) are already included as dependencies:
}, [
type,
groupBy,
groupCurrency,
withdrawalType,
displayDate,
displayPosted,
displayWithdrawn,
filterFormValues.from,
filterFormValues.feed,
filterFormValues.postedOn,
filterFormValues.postedAfter,
filterFormValues.postedBefore,
filterFormValues.withdrawalType,
filterFormValues.withdrawnOn,
filterFormValues.withdrawnAfter,
filterFormValues.withdrawnBefore,
translate,
hasComponent,
isComponent,
typeComponent,
groupByComponent,
groupCurrencyComponent,
statusComponent,
datePickerComponent,
userPickerComponent,
postedPickerComponent,
withdrawalTypeComponent,
withdrawnPickerComponent,
status,
personalDetails,
feed,
feedComponent,
feedOptions.length,
hasMultipleOutputCurrency,
has,
is,
workspaceCount, // Keep this
shouldDisplayWorkspaceFilter, // Keep this
workspaceOptions, // Keep this
selectedWorkspaceOptions, // Keep this
workspaceComponent, // Keep this
workspaceValue, // Keep this
filterFormValues.policyID, // Keep this
// Remove: workspaces
]);
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
…er of several workspaces
0a63e34 to
2a862c1
Compare
|
Hello @Pujan92 PR is ready. Let me know if the test steps are LGTY, since I will record demos based on that. |
|
🚧 @Julesssss 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, Desktop, and Web. Happy testing! 🧪🧪
|
|
Looks good from my end. Mote to @JmillsExpensify for future: I think it'd be good for us to persist the filters that are shared amongst suggested searches. It's a bit jarring to pick a workspace, then swap from Submit to Approve in the LHN and you have to pick a workspace filter again each time. |
…kspace-when-a-user-is-a-member-of-several-workspaces
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppSimulator.Screen.Recording.-.iPhone.15.Pro.-.2025-11-22.at.21.40.06.movMacOS: Chrome / SafariScreen.Recording.2025-11-22.at.21.18.32.movMacOS: Desktop |
|
@TaduJR Plz add a recordings |
|
Adding now |
Done. |
|
The checklist are incomplete. |
|
@Julesssss plz re-run the checks |
Yeah, good call. I'll create a separate issue for this now. |
JmillsExpensify
left a comment
There was a problem hiding this comment.
Looks good on behalf of product team.
…kspace-when-a-user-is-a-member-of-several-workspaces
…kspace-when-a-user-is-a-member-of-several-workspaces
|
🚀 Deployed to staging by https://github.com/Julesssss in version: 9.2.63-0 🚀
|
|
🚀 Deployed to production by https://github.com/marcaaron in version: 9.2.63-8 🚀
|

Explanation of Change
This PR adds an exposed "Workspace" filter to the Search/Reports page that appears when a user is a member of 2 or more workspaces.
Key Implementation Details:
useWorkspaceListhook (same as Advanced Filters) for consistency and DRY principlescreateMultiSelectComponentutility (same pattern as feed, status, has, is filters)Fixed Issues
$ #75209
PROPOSAL: #75209 (comment)
Tests
Prerequisite: Ensure your test account is a member of 2 or more workspaces
Test with 1 workspace:
Test with 0 workspaces:
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
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-Native.mp4
Android: mWeb Chrome
Android-mWeb.mp4
iOS: Native
iOS-Native.mp4
iOS: mWeb Safari
iOS-Safari.mp4
MacOS: Chrome / Safari
Mac-Chrome.mp4
MacOS: Desktop
Mac-Desktop.mp4