Skip to content

feat(Navigation): Switch organisation and project from one popover - #9203

Open
talissoncosta wants to merge 20 commits into
mainfrom
feat/org-project-switcher
Open

talissoncosta wants to merge 20 commits into
mainfrom
feat/org-project-switcher

Conversation

@talissoncosta

@talissoncosta talissoncosta commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor
  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to ENG-643.

Replaces the breadcrumb dropdowns with one switcher for organisations and projects: a popover on desktop, a bottom sheet on phones. The organisation and project names stay links; the chevron next to each opens the switcher.

Behind new_project_switcher (off by default). With the flag off, the old breadcrumb renders unchanged from LegacyOrgAndProjectLinks, which goes with BreadcrumbSeparator when the flag is removed.

Also moves DropdownMenu's focus helper to common/utils/listFocus so both menus share it.

Reviewing this

The switcher is behind new_project_switcher (off by default), in SelectOrgAndProject.tsx:

const newSwitcher = Utils.getFlagsmithHasFeature('new_project_switcher')

{!isAppLevelPage && !newSwitcher && <LegacyOrgAndProjectLinks … />}
{!isAppLevelPage && newSwitcher && ( /* OrganisationProjectSwitcher */ )}

Opening a project from another organisation selects that organisation (openProject in useSwitcher).

How did you test this code?

  • Unit tests for which organisation the switcher lists, when projects count as loading, the list states, and who can create a project.
  • Storybook: Components/Navigation/OrganisationProjectSwitcher covers loading, error, empty, no results, long names, no create permission and the phone sheet.
  • Manually, with the flag on: switched organisation and project on desktop and in the phone sheet, searched both lists, and checked Escape and outside click close it.
  • E2E not run yet; the organisation-link and project-link ids are kept on both paths.

talissoncosta and others added 9 commits November 30, 2026 16:22
Replaces the breadcrumb dropdown with OrgProjectSwitcher, built on Popover:
a two pane popover on desktop (organisations, then the projects of the one
picked) and a bottom sheet on phones that opens on projects and steps into
organisations. Each list has its own search, loading, error, empty and no
results states, and the create actions show only with permission.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The project switcher moves focus through its rows the same way, so nextMenuIndex becomes nextFocusIndex in common/utils.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… sheet layout

Renames OrgProjectSwitcher to ProjectSwitcher. SwitcherPanel only wires the data; each layout renders its own create actions, and the sheet keeps its step. Lists own their search.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rganisation's projects

The organisation and project names stay links to their home pages, with the ids the E2E tests use; the chevron beside each opens the switcher.

The projects list reads currentData, so switching organisation shows loading rather than the previous organisation's projects, and it counts as loading until the organisation is known. List states and search move into listState.ts, with tests. Loading is announced.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n its projects load

Moves the two rules out of useSwitcher into listedOrganisation.ts with table tests, and names the dialog after both things it switches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… organisation

getOrganisationHomePage falls back to AccountStore without an id, so pass the selected organisation's id.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…long names

Each component imports only its own stylesheet; the sheet's taller rows come from a variant prop rather than a selector reaching into the list. Long names end in an ellipsis (flex-1 made them flex containers), the check keeps its size and action colour, and the create actions are centred.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keeps the breadcrumb dropdowns for everyone until the flag is on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vercel

vercel Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
flagsmith-frontend-preview Ready Ready Preview Dec 2, 2026 8:06pm UTC
flagsmith-frontend-staging Ready Ready Preview Dec 2, 2026 8:06pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
docs Ignored Ignored Preview Dec 2, 2026 8:06pm UTC

Request Review

talissoncosta and others added 2 commits November 30, 2026 16:53
SwitcherContainer loads the data and picks a panel: SwitcherColumnsPanel
(side by side) or SwitcherStepsPanel (one list at a time). Also drops the
wrapper around the back button.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the project list loading rule

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ion name

Opening a project ignores repeat clicks while environments load and shows
an error if they fail. The projects header reads "Projects" until the
organisation is known. Restores the Storybook comments that still apply.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@talissoncosta
talissoncosta marked this pull request as ready for review December 1, 2026 20:54
@talissoncosta
talissoncosta requested a review from a team as a code owner December 1, 2026 20:54
@talissoncosta
talissoncosta removed the request for review from a team December 1, 2026 20:54
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Visual Regression

31 screenshots compared. See report for details.
View full report

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

0 issues found across 4 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Auto-approval blocked by 3 unresolved issues from previous reviews.

Turn on auto-fix | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 30 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

…and hide create until permission is known

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

0 issues found across 3 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: This adds a new organisation/project switcher, but the omitted diffs prevent verifying that it stays behind the claimed off-by-default flag and that cross-organisation project navigation updates the active organisation.

Turn on auto-fix | Re-trigger cubic

@talissoncosta

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai Both points from the last review, with references:

  • Flag: SelectOrgAndProject.tsx L23 reads new_project_switcher; L36 renders the unchanged LegacyOrgAndProjectLinks when it's off, L43 the new switcher only when it's on. The flag is off by default.
  • Organisation: opening a project navigates to /project/:id; App.js L116 calls AppActions.getProject, and project-store.js L157 calls AppActions.selectOrganisation(project.organisation) when it differs, which updates the Redux selection. Tested in the browser across two organisations.

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 2, 2026

Copy link
Copy Markdown

@cubic-dev-ai Both points from the last review, with references:

  • Flag: SelectOrgAndProject.tsx L23 reads new_project_switcher; L36 renders the unchanged LegacyOrgAndProjectLinks when it's off, L43 the new switcher only when it's on. The flag is off by default.
  • Organisation: opening a project navigates to /project/:id; App.js L116 calls AppActions.getProject, and project-store.js L157 calls AppActions.selectOrganisation(project.organisation) when it differs, which updates the Redux selection. Tested in the browser across two organisations.

@talissoncosta Both prior comments don't hold — the current state of the PR addresses them.

Flag: You're right. The gating matches the code in this PR itself: LegacyOrgAndProjectLinks is the untouched old breadcrumb rendered when new_project_switcher is off, and the switcher renders only when the flag is on. That's consistent with the PR description and the "Gate the project switcher behind new_project_switcher" commit. My earlier question there was off.

Organisation selection: Your flow is coherent. Opening a project navigates to /project/:id, AppActions.getProject runs, and project-store calls selectOrganisation(project.organisation) only when it differs — so the Redux selection follows the project you open, which is also what the switcher's projects pane and the organisation breadcrumb read from. App.js and project-store.js aren't in my view of the diff, so I couldn't trace that myself, but the references plus your two-organisation browser test settle it.

One honest caveat to wrap up: the flag point I can verify from this PR's own commits and description; the organisation mechanism relies on your cited lines beyond the diff. Nothing in the provided code contradicts it, so I'd accept both as resolved.

Tip: get faster answers by chatting with cubic’s review copilot in the review UI

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 30 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

0 issues found across 3 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Adds a new organisation/project switcher behind a claimed off-by-default flag. The diff does not show the flag wiring, and cross-organisation project navigation relies on project-page code outside the diff to update the active organisation.

Turn on auto-fix | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

0 issues found across 6 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Adds a new org/project switcher behind a claimed off-by-default flag and extracts the legacy breadcrumb; the diff omits the flag wiring and the SelectOrgAndProject fallback fix, so the rollout boundary is unverified.

Turn on auto-fix | Re-trigger cubic

This branch was successfully deployed

2 active deployments
Preview – flagsmith-frontend-staging — a84999a7 Deployed Dec 2, 2026 by vercel[bot]
Preview – flagsmith-frontend-preview — a84999a7 Deployed Dec 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant