Skip to content

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

@talissoncosta

Description

@talissoncosta

Description

When a non-admin user switches organisations via the breadcrumb dropdown, the displayed organisation name in the top navigation doesn't update to reflect the selected organisation. The page content (projects list, tabs) updates correctly, but the breadcrumb stays on the previous org name.

Root Cause

SelectOrgAndProject.tsx uses useGetOrganisationQuery which calls GET /api/v1/organisations/{id}/ — a detail endpoint that returns 403 for non-admin users. When the query fails silently, the component falls back to stale data from AccountStore.getOrganisation()?.name, which doesn't trigger re-renders because the component doesn't subscribe to store changes.

Additionally, BreadcrumbSeparator.tsx has a listener cleanup bug: line 180 unsubscribes from OrganisationStore instead of AccountStore, leaking event listeners.

Steps to Reproduce

  1. Log in as a non-admin user with access to multiple organisations
  2. Navigate to any org page
  3. Open the breadcrumb dropdown (chevron arrows next to org name)
  4. Select a different organisation
  5. Observe: URL and page content update correctly, but the breadcrumb name stays on the previous org

Fix

  • Introduce a selectedOrganisationSlice in Redux to hold the selected org ID
  • Create a useSelectedOrganisation hook that combines the Redux slice with useGetOrganisationsQuery (list endpoint, accessible to all members)
  • Replace the broken useGetOrganisationQuery (detail endpoint, 403 for non-admins) in SelectOrgAndProject
  • Bridge AccountStore.selectOrganisation to dispatch into Redux during the migration period
  • Fix the listener cleanup in BreadcrumbSeparator

Credit

Reported by @kyle-ssg

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions