Fix search filter tags/categories showing items from other workspaces#84679
Fix search filter tags/categories showing items from other workspaces#84679
Conversation
When a workspace is selected in search filters but has no tags/categories, the filter pages incorrectly fall back to showing tags/categories from all workspaces. Change the condition to check whether a workspace filter is applied (policyIDs.length === 0) rather than whether the result is empty, so that selecting a workspace with no tags/categories correctly shows an empty list instead of items from other workspaces. Co-authored-by: Cong Pham <suneox@users.noreply.github.com>
Co-authored-by: Cong Pham <suneox@users.noreply.github.com>
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
The failing Analysis: The ESLint warnings are all in files not touched by this PR:
This PR only modifies Evidence: The ESLint check is also failing on |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppCleanShot.2026-03-10.at.22.49.08.3.mp4Android: mWeb ChromeCleanShot.2026-03-10.at.23.00.43.4.mp4iOS: HybridAppCleanShot.2026-03-10.at.23.01.59.5.mp4iOS: mWeb SafariCleanShot.2026-03-10.at.22.35.08.2.mp4MacOS: Chrome / SafariCleanShot.2026-03-10.at.22.19.51.1.mp4 |
|
@MelvinBot update PR status to ready |
|
PR has been marked as Ready for Review as requested. |
|
The failing ESLint check is unrelated to this PR. The filter tag loading issue also occurs on the latest staging, so it should be tracked as a separate issue Tag loading issueCleanShot.2026-03-10.at.23.08.04.1.mp4 |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #84239 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Good for product
|
Looks like this PR pushes us over the max threshold of eslint warnings. Not sure if they're new or it just needs a main merge |
|
@MelvinBot please merge code with the latest main branch |
…rTagsCategoryWorkspace Co-authored-by: Cong Pham <suneox@users.noreply.github.com>
|
Merged the latest |
|
The failing check is unrelated to this PR. Analysis: The only failing test is This is a mock configuration issue in Evidence: This PR only modifies two files:
Neither file is related to |
|
The failing checks are unrelated to this PR's changes (which only modify 1. test (job 7) — The test fails with: The mock file imports 2. validate / check — Timeout This job ran for exactly 10 minutes before being terminated with no step-level failure, indicating an infrastructure timeout unrelated to code changes. Evidence: This PR's changes are limited to search filter condition logic and do not touch permissions, IOU flows, or CI configuration. The broken mock exists identically on |
|
@MelvinBot Merge main and then verify unit test & pr author checklist |
…rTagsCategoryWorkspace Co-authored-by: Cong Pham <suneox@users.noreply.github.com>
|
Merged Unit Tests ✅Ran all related unit tests after the merge — all pass:
PR Author Checklist VerificationI reviewed the checklist against the actual code changes (2 files:
|
Explanation of Change
When a user filters search results by a specific workspace and then opens the Tags or Categories filter, items from all workspaces are displayed instead of only items from the selected workspace. This happens because the condition that decides whether to show all tags/categories checks if the result list is empty rather than checking if a workspace filter was applied. When the selected workspace has no tags or categories, the empty result triggers the fallback path that shows everything from all workspaces.
This PR changes the condition in both
SearchFiltersTagPage.tsxandSearchFiltersCategoryPage.tsxfrom checkingselectedPoliciesTagLists.length === 0/selectedPoliciesCategories.length === 0to checkingpolicyIDs.length === 0. Now:Fixed Issues
$ #84239
PROPOSAL: #84239 (comment)
Tests
workspace:then select the workspace without tagsOffline tests
N/A — This change only affects how filter options are displayed in the UI based on already-cached Onyx data. No network calls are involved.
QA Steps
workspace:in the search field and select the workspace without tagsPR 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))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
N/A — Logic-only change, no UI modification
Android: mWeb Chrome
N/A — Logic-only change, no UI modification
iOS: Native
N/A — Logic-only change, no UI modification
iOS: mWeb Safari
N/A — Logic-only change, no UI modification
MacOS: Chrome / Safari
N/A — Logic-only change, no UI modification