Workspace filter is displayed when account has no workspace#59943
Conversation
| searchTerm: debouncedSearchTerm, | ||
| }); | ||
|
|
||
| const isWorkspaceNameStillPresent = (filterTitle: string | undefined) => workspaces.some((section) => section.data?.some((item) => item.text === filterTitle)); |
There was a problem hiding this comment.
I added this to prevent scenarios like this:
Screen.Recording.2025-04-09.at.18.16.07.mov
There was a problem hiding this comment.
Can you please explain why?
There was a problem hiding this comment.
As you can see in the 0:30 of recording, after adding a new workspace, the first workspace is selected by default, even though we don't have that one. It's actually the previously selected workspace, which had been deleted earlier — that's why I'm checking if it's still present.
There was a problem hiding this comment.
Why don't we use workspaces to get selectedWorkspaceName, like const selectedWorkspaceName = baseFilterConfig[key].getTitle(searchAdvancedFilters, workspaces);?
There was a problem hiding this comment.
Or filter the policy data using shouldShowPolicy
There was a problem hiding this comment.
I tried not to disrupt the logic we've been using so far to avoid introducing new bugs.
If you think it's better to change it, I can do that, but my solution seems quite clear to me and doesn't disrupt the previous logic, the only issue with which was showing the filter when it wasn't necessarily needed.
There was a problem hiding this comment.
@sumo-slonik What do you mean about the previous logic?
baseFilterConfig[key].getTitle(searchAdvancedFilters, policies);
this logic is new and under beta. Furthermore, we're getting the name from policies (policies can contain the deleted WS) then use workspaces to check if it's present or not. Why don't we just use data from workspaces
Here is my sample code
const data = workspaces.flatMap((section) => section.data);
...
filterTitle = baseFilterConfig[key].getTitle(searchAdvancedFilters, data);
What do you think?
There was a problem hiding this comment.
I think it makes sense. I know it's behind the beta here, but I was afraid of breaking something that was already working in it. But now I understand what you mean, and it seems like a reasonable fix to me.
|
@dukenv0307 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] |
|
@sumo-slonik Please let me know when it's ready for review again |
|
@dukenv0307 I think it's ready to be reviewed again |
ae0462a to
67b6794
Compare
|
Looks good, just left 1 minor comment |
…pace-filter-is-displayed-when-account-has-no-workspace
|
Fixed :D |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2025-04-15.at.22.22.13.movAndroid: mWeb ChromeScreen.Recording.2025-04-15.at.22.19.48.moviOS: NativeScreen.Recording.2025-04-15.at.22.22.26.moviOS: mWeb SafariScreen.Recording.2025-04-15.at.22.19.30.movMacOS: Chrome / Safariweb-resize.mp4MacOS: DesktopScreen.Recording.2025-04-15.at.22.23.46.mov |
| */ | ||
| const typeFiltersKeys: Record<string, Array<Array<ValueOf<typeof CONST.SEARCH.SYNTAX_FILTER_KEYS>>>> = { | ||
| [CONST.SEARCH.DATA_TYPES.EXPENSE]: [ | ||
| [CONST.SEARCH.SYNTAX_FILTER_KEYS.KEYWORD, CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM, CONST.SEARCH.SYNTAX_FILTER_KEYS.TO], |
There was a problem hiding this comment.
I think the policy filter should be available for other search types too (expense reports, trips etc) as those are also associated with policies
There was a problem hiding this comment.
Going to discuss with the team
|
🚧 @mountiny has triggered a test 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, Desktop, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.1.29-0 🚀
|
|
🚀 Deployed to production by https://github.com/marcaaron in version: 9.1.29-10 🚀
|

Explanation of Change
Fixed Issues
$ #59882
PROPOSAL:
Tests
Precondition:
Account has no workspace.
Expected: There should be no workspace filter.
Expected: There should be a workspace filter.
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)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))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.2025-04-10.at.12.00.19.mov
Android: mWeb Chrome
android.web.mov
iOS: Native
ios.mov
iOS: mWeb Safari
ios.web.mov
MacOS: Chrome / Safari
Screen.Recording.2025-04-09.at.18.37.56.mov
MacOS: Desktop