Skip to content

fix: refresh Flagsmith organisation traits when the selected organisation changes - #8485

Merged
Zaimwa9 merged 2 commits into
mainfrom
fix/identify-on-organisation-change
Sep 8, 2026
Merged

fix: refresh Flagsmith organisation traits when the selected organisation changes#8485
Zaimwa9 merged 2 commits into
mainfrom
fix/identify-on-organisation-change

Conversation

@Zaimwa9

@Zaimwa9 Zaimwa9 commented Sep 8, 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

Flagsmith traits were only sent on login, so org-scoped segments were evaluated against whichever org you logged in under. selectOrganisation now refreshes them via setTraits (not identify — keeps bucketing intact). Covers org creation too, which routes through the same action.

How did you test this code?

Manually: with a flag segmented on organisation.id, switching orgs now flips the gated UI without a refresh.

@Zaimwa9
Zaimwa9 requested a review from a team as a code owner September 8, 2026 15:33
@Zaimwa9
Zaimwa9 requested review from kyle-ssg and removed request for a team September 8, 2026 15:33
@vercel

vercel Bot commented Sep 8, 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 Sep 8, 2026 3:53pm UTC
flagsmith-frontend-staging Ready Ready Preview Sep 8, 2026 3:53pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
docs Ignored Ignored Preview Sep 8, 2026 3:53pm UTC

Request Review

@Zaimwa9
Zaimwa9 requested review from talissoncosta and removed request for kyle-ssg September 8, 2026 15:34
@github-actions github-actions Bot added the front-end Issue related to the React Front End Dashboard label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

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

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

selectOrganisation now calls flagsmith.setTraits with the selected organisation's ID, name, and subscription plan. The existing Flagsmith identity and bucketing remain unchanged.

Priority: ⬇️ Low — Defer the organisation trait refresh because it is a narrow frontend change limited to updating flags for the selected organisation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: 🔵 Low · up to f51e8

Organisation selection now refreshes Flagsmith traits so organisation-scoped UI follows the active organisation. Rapid switching may briefly leave gated UI evaluated against a previously selected organisation until refresh ordering is guarded.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 8, 2026

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

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  12.6 seconds
commit  f51e8c2
info  🔄 Run: #20300 (attempt 1)

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

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  33.3 seconds
commit  f51e8c2
info  🔄 Run: #20300 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  45.7 seconds
commit  f51e8c2
info  🔄 Run: #20300 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  33.9 seconds
commit  f51e8c2
info  🔄 Run: #20300 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #20297 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  1 minute, 11 seconds
commit  87a8ec4
info  🔄 Run: #20297 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #20297 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  41 seconds
commit  87a8ec4
info  🔄 Run: #20297 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  39.7 seconds
commit  87a8ec4
info  🔄 Run: #20297 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  39.5 seconds
commit  87a8ec4
info  🔄 Run: #20297 (attempt 1)

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: f488fe00-558f-46e1-9d10-7a92d20aeac7

📥 Commits

Reviewing files that changed from the base of the PR and between e5a1ec0 and 87a8ec4.

📒 Files selected for processing (1)
  • frontend/common/stores/account-store.js

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Comment thread frontend/common/stores/account-store.js Outdated
talissoncosta
talissoncosta previously approved these changes Sep 8, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/common/stores/account-store.js (1)

117-118: 🗄️ Data Integrity & Integration | 🟠 Major

Update Flagsmith traits on direct organisation mutations.

createOrganisation, deleteOrganisation, and editOrganisation assign store.organisation directly. These paths do not call selectOrganisation, so the new trait update is bypassed. Flagsmith can retain the previous organisation's organisation.id, organisation.name, and subscription.plan traits after an organisation is created, edited, or deleted. Route active-organisation changes through one shared trait-update helper, and clear the traits when no organisation remains.

Also applies to: 148-151, 172-174


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 31ffb7d9-d2ae-4147-8132-73e067c5c9e3

📥 Commits

Reviewing files that changed from the base of the PR and between 87a8ec4 and f51e8c2.

📒 Files selected for processing (1)
  • frontend/common/stores/account-store.js

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Comment thread frontend/common/stores/account-store.js
@Zaimwa9
Zaimwa9 merged commit f16ad68 into main Sep 8, 2026
28 checks passed
@Zaimwa9
Zaimwa9 deleted the fix/identify-on-organisation-change branch September 8, 2026 18:51
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.

2 participants