Skip to content

[WIP]: refactor(Account): Read the current organisation and user through hooks - #9026

Draft
talissoncosta wants to merge 7 commits into
mainfrom
refactor/current-organisation-facade
Draft

talissoncosta wants to merge 7 commits into
mainfrom
refactor/current-organisation-facade

Conversation

@talissoncosta

@talissoncosta talissoncosta commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for submitting a PR! Please check the boxes below:

  • 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 #7947

Components read the current organisation, admin role and user through one set of hooks instead of calling AccountStore directly. The hooks still read Flux, so nothing changes for users. Moving to RTK Query later becomes a small PR that only touches the hooks.

  • useCurrentOrganisation / getCurrentOrganisation, useIsOrganisationAdmin, useCurrentUser / getCurrentUser, and withCurrentOrganisation for App.js.
  • Every AccountStore.getOrganisation(), isAdmin(), getUser() and getUserId() read now goes through them (218 direct AccountStore reads down to 73).
  • The hooks return undefined when there is no organisation or user, so each call site now handles that: queries skip, handlers return early.
  • The hooks re-render on every AccountStore change, including one between render and subscribe.
  • A lint warning on new AccountStore imports, so new code reads through the hooks. Only the store and the hooks that wrap it are exempt.

Draft: will be split into smaller stacked PRs before review.

How did you test this code?

  • Unit tests for the organisation and user getters.
  • Unit tests, lint and type check (no new errors) after rebasing on main.
  • npm run bundle after rebasing on main.
  • E2E.
  • Manually: log in with one and with several organisations, switch organisation, create and delete an organisation, accept an invite, and use the app as a non-admin.

@vercel

vercel Bot commented Nov 19, 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 Nov 27, 2026 4:42pm UTC
flagsmith-frontend-staging Ready Ready Preview Nov 27, 2026 4:42pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
docs Ignored Ignored Preview Nov 27, 2026 4:42pm UTC

Request Review

@github-actions github-actions Bot added the front-end Issue related to the React Front End Dashboard label Nov 19, 2026
@talissoncosta
talissoncosta marked this pull request as ready for review November 19, 2026 19:42
@talissoncosta
talissoncosta requested a review from a team as a code owner November 19, 2026 19:42
@talissoncosta
talissoncosta requested review from kyle-ssg and removed request for a team November 19, 2026 19:42
@talissoncosta talissoncosta changed the title refactor(Account): Read the current organisation and user through hooks [WIP]: refactor(Account): Read the current organisation and user through hooks Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Docker builds report

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

@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 66 files

Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack

Turn on auto-fix | Re-trigger cubic

Comment thread frontend/web/components/FlagOwners.tsx Resolved
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor
✅ private-cloud · depot-ubuntu-latest-16 — run #23490 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 3 seconds
commit  32f4e70
info  🔄 Run: #23490 (attempt 1)

🗂️ Previous results
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #23490 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  44.6 seconds
commit  32f4e70
info  🔄 Run: #23490 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #23490 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  36.2 seconds
commit  32f4e70
info  🔄 Run: #23490 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #23490 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  32.1 seconds
commit  32f4e70
info  🔄 Run: #23490 (attempt 1)

@github-actions

Copy link
Copy Markdown
Contributor

Visual Regression

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

@talissoncosta
talissoncosta marked this pull request as draft November 20, 2026 18:41
talissoncosta and others added 5 commits November 27, 2026 11:49
…ation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cade

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Count account store changes so a change between render and subscribe still re-renders
- Mark only the current user as (You) in the permissions list
- Read the organisation id from a ref in the environment save handler
- Skip the groups query and the invite link reset without an organisation
- Keep the role's own organisation in its permissions tab
- Read currentData so an organisation switch never shows the previous list
- Save the last environment only with its organisation
- Hide the custom fields input without an organisation
- Drop an unused organisation read in the users page

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
talissoncosta and others added 2 commits November 27, 2026 13:40
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Components read the organisation and user through the facade hooks, so a new direct import is a read the Flux to RTK migration would have to move again. Only the store and the hooks that wrap it may import it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant