Skip to content

fix: Organisation breadcrumb shows wrong name for non-admin users#7234

Open
talissoncosta wants to merge 6 commits intomainfrom
fix/org-breadcrumb-non-admin
Open

fix: Organisation breadcrumb shows wrong name for non-admin users#7234
talissoncosta wants to merge 6 commits intomainfrom
fix/org-breadcrumb-non-admin

Conversation

@talissoncosta
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

Closes #7233

Non-admin users switching organisations via the breadcrumb dropdown see a stale org name. The page content updates correctly but the breadcrumb stays on the previous organisation.

Root cause: SelectOrgAndProject used useGetOrganisationQuery which calls GET /api/v1/organisations/{id}/ — a detail endpoint that returns 403 for non-admin users. The query fails silently and the component shows stale data.

Fix:

  • Introduced a selectedOrganisationSlice in Redux to hold the selected org ID
  • Created a useSelectedOrganisation hook that combines the Redux slice with useGetOrganisationsQuery (list endpoint, accessible to all members)
  • Bridged AccountStore.selectOrganisation to dispatch into Redux during the Flux→RTK migration
  • Fixed a listener cleanup bug in BreadcrumbSeparator (was unsubscribing from OrganisationStore instead of AccountStore)

How did you test this code?

  1. Log in as a non-admin user with access to multiple organisations
  2. Open the breadcrumb dropdown and switch organisations
  3. Verify the breadcrumb name updates to the selected organisation
  4. Verify page content (projects, tabs) also updates correctly

Reported by @kyle-ssg

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

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

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview, Comment Apr 15, 2026 0:37am
flagsmith-frontend-staging Ready Ready Preview, Comment Apr 15, 2026 0:37am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Apr 15, 2026 0:37am

Request Review

@github-actions github-actions bot added front-end Issue related to the React Front End Dashboard fix labels Apr 14, 2026
@talissoncosta talissoncosta marked this pull request as ready for review April 14, 2026 15:40
@talissoncosta talissoncosta requested a review from a team as a code owner April 14, 2026 15:40
@talissoncosta talissoncosta requested review from kyle-ssg and removed request for a team April 14, 2026 15:40
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, reopen this pull request to trigger a review.

@github-actions github-actions bot added fix and removed fix labels Apr 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-7234 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-7234 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-7234 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7234 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7234 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-7234 Finished ✅ Results

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  1.4 seconds
commit  4b6b4bd
info  🔄 Run: #16036 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  48.8 seconds
commit  4b6b4bd
info  🔄 Run: #16036 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  17 passed

Details

stats  17 tests across 14 suites
duration  1 minute
commit  4b6b4bd
info  🔄 Run: #16036 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  47.8 seconds
commit  4b6b4bd
info  🔄 Run: #16036 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  43.8 seconds
commit  f980efa
info  🔄 Run: #16062 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  28.9 seconds
commit  f980efa
info  🔄 Run: #16062 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  17 passed

Details

stats  17 tests across 14 suites
duration  1 minute, 2 seconds
commit  f980efa
info  🔄 Run: #16062 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  46.9 seconds
commit  f980efa
info  🔄 Run: #16062 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  24.6 seconds
commit  2cc922b
info  🔄 Run: #16063 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  27.8 seconds
commit  2cc922b
info  🔄 Run: #16063 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  45.1 seconds
commit  2cc922b
info  🔄 Run: #16063 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  58.8 seconds
commit  2cc922b
info  🔄 Run: #16063 (attempt 1)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

Visual Regression

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

@kyle-ssg
Copy link
Copy Markdown
Member

@talissoncosta ready to go, just needs conflicts sorting

talissoncosta and others added 5 commits April 15, 2026 09:15
Introduces a Redux slice to hold the selected organisation ID,
replacing the reliance on AccountStore for this state. This is the
first step towards migrating organisation selection from Flux to RTK.

Closes #7233

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Combines the Redux slice's selected org ID with useGetOrganisationsQuery
(list endpoint) to return the full organisation object. Uses the list
endpoint which is accessible to all org members, unlike the detail
endpoint which returns 403 for non-admins.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dispatches setSelectedOrganisationId into the Redux store whenever
selectOrganisation or setUser runs in AccountStore. This keeps both
stores in sync during the migration from Flux to RTK.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace useGetOrganisationQuery (detail endpoint, 403 for non-admins)
with useSelectedOrganisation hook that reads from the organisations
list endpoint via Redux. This fixes the breadcrumb showing stale org
names when non-admin users switch organisations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The useEffect cleanup was unsubscribing from OrganisationStore instead
of AccountStore, leaking event listeners on every unmount/remount.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Drop the cookie side-effect from the reducer:
- Reducers must be pure functions; side effects break time-travel
  debugging, hot reload, and testing
- The cookie was being written twice — AccountStore.selectOrganisation
  already writes it before dispatching

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the fix label Apr 15, 2026
Copy link
Copy Markdown
Contributor

@Zaimwa9 Zaimwa9 left a comment

Choose a reason for hiding this comment

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

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Organisation breadcrumb shows wrong name for non-admin users

3 participants