Skip to content

fix(project-filters): Handle 'All Projects' display for users with no member projects#111329

Merged
JonasBa merged 2 commits intomasterfrom
cursor/project-filters-url-expansion-b46b
Mar 24, 2026
Merged

fix(project-filters): Handle 'All Projects' display for users with no member projects#111329
JonasBa merged 2 commits intomasterfrom
cursor/project-filters-url-expansion-b46b

Conversation

@JonasBa
Copy link
Member

@JonasBa JonasBa commented Mar 23, 2026

Problem

When a user has no member projects (their team doesn't own/belong to any projects) and the URL contains project=-1 (All Projects sentinel), the project filter trigger was incorrectly displaying a project count or enumerated list instead of the "All Projects" label.

Root Cause

  1. The URL parameter -1 (ALL_ACCESS_PROJECTS) gets expanded internally to all individual project IDs
  2. The trigger's isAllProjectsSelected logic was checking if both isMyProjectsSelected AND isNonMemberProjectsSelected were true
  3. isMyProjectsSelected requires memberProjects.length > 0 to be true
  4. When a user has no member projects, this check fails even though all projects are selected

Solution

Updated the logic in projectPageFilterTrigger.tsx to directly check if the value array contains all project IDs, regardless of the member/non-member split. This correctly handles the edge case.

Changes

  • Modified ProjectPageFilterTrigger to use a containsAllProjects check that verifies all project IDs are present in the value array
  • Added test cases to cover users with no member projects
  • Removed unused isNonMemberProjectsSelected variable

Testing

  • Added two new test cases in projectPageFilter.spec.tsx:
    • Verifies "All Projects" label is shown when URL has -1 and user has no member projects
    • Verifies "All Projects" label is shown when URL is empty (defaults to all) and user has no member projects
  • All pre-commit hooks pass

Fixes the issue described in the Slack thread where the UI was showing a count instead of "All Projects" for users without member projects.

Slack Thread

Open in Web Open in Cursor 

… member projects

When a user has no member projects and the URL contains -1 (All Projects sentinel),
the filter was incorrectly displaying a project count or enumerated list instead of
'All Projects'.

The issue occurred because:
1. URL parameter -1 gets expanded to all individual project IDs
2. The trigger's logic checked if both member AND non-member projects were selected
3. When memberProjects.length === 0, this check failed

Fix: Check if value contains all project IDs regardless of member/non-member split.

Added tests to cover the edge case of users with no member projects.

Co-authored-by: Jonas <JonasBa@users.noreply.github.com>
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 23, 2026
Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirming this fixes the issue for me!

@JonasBa JonasBa marked this pull request as ready for review March 23, 2026 18:40
@JonasBa JonasBa requested a review from a team as a code owner March 23, 2026 18:40
@JonasBa JonasBa merged commit a5e455a into master Mar 24, 2026
70 checks passed
@JonasBa JonasBa deleted the cursor/project-filters-url-expansion-b46b branch March 24, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants