fix: Organisation breadcrumb shows wrong name for non-admin users#7234
fix: Organisation breadcrumb shows wrong name for non-admin users#7234talissoncosta wants to merge 6 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
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.
Docker builds report
|
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
|
Visual Regression16 screenshots compared. See report for details. |
|
@talissoncosta ready to go, just needs conflicts sorting |
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>
4b6b4bd to
f980efa
Compare
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>
docs/if required so people know about the feature.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:
SelectOrgAndProjectuseduseGetOrganisationQuerywhich callsGET /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:
selectedOrganisationSlicein Redux to hold the selected org IDuseSelectedOrganisationhook that combines the Redux slice withuseGetOrganisationsQuery(list endpoint, accessible to all members)AccountStore.selectOrganisationto dispatch into Redux during the Flux→RTK migrationBreadcrumbSeparator(was unsubscribing fromOrganisationStoreinstead ofAccountStore)How did you test this code?
Reported by @kyle-ssg