-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Workspace filter is displayed when account has no workspace #59943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please explain why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we use workspaces to get selectedWorkspaceName, like const selectedWorkspaceName = baseFilterConfig[key].getTitle(searchAdvancedFilters, workspaces);
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or filter the policy data using shouldShowPolicy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@@ -160,7 +162,7 @@ const baseFilterConfig = { | |||
*/ | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.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