From 87a8ec4305070a830d6c781cfc0331a4274f1bca Mon Sep 17 00:00:00 2001 From: wadii Date: Tue, 8 Sep 2026 17:32:10 +0200 Subject: [PATCH 1/2] fix: refresh Flagsmith organisation traits when the selected organisation changes --- frontend/common/stores/account-store.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/common/stores/account-store.js b/frontend/common/stores/account-store.js index d1878ddc437e..e0a275234456 100644 --- a/frontend/common/stores/account-store.js +++ b/frontend/common/stores/account-store.js @@ -350,6 +350,14 @@ const controller = { API.setCookie('organisation', `${id}`) store.organisation = find(store.model.organisations, { id }) getStore().dispatch(setSelectedOrganisationId(id)) + // Keep the org-scoped traits pointing at the organisation on screen, so + // org-scoped segments are evaluated against it. setTraits rather than + // identify: the identity is unchanged, so bucketing is undisturbed. + flagsmith.setTraits({ + 'organisation.id': String(id), + 'organisation.name': store.organisation?.name ?? '', + 'subscription.plan': store.organisation?.subscription?.plan ?? '', + }) store.changed() identifyChatUser() }, From f51e8c2d498c7e30d2c118f163503883b4a4f77b Mon Sep 17 00:00:00 2001 From: wadii Date: Tue, 8 Sep 2026 17:52:02 +0200 Subject: [PATCH 2/2] fix: swallow trait refresh rejection --- frontend/common/stores/account-store.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/common/stores/account-store.js b/frontend/common/stores/account-store.js index e0a275234456..88fe5b65fe10 100644 --- a/frontend/common/stores/account-store.js +++ b/frontend/common/stores/account-store.js @@ -353,11 +353,13 @@ const controller = { // Keep the org-scoped traits pointing at the organisation on screen, so // org-scoped segments are evaluated against it. setTraits rather than // identify: the identity is unchanged, so bucketing is undisturbed. - flagsmith.setTraits({ - 'organisation.id': String(id), - 'organisation.name': store.organisation?.name ?? '', - 'subscription.plan': store.organisation?.subscription?.plan ?? '', - }) + flagsmith + .setTraits({ + 'organisation.id': String(id), + 'organisation.name': store.organisation?.name ?? '', + 'subscription.plan': store.organisation?.subscription?.plan ?? '', + }) + .catch(() => {}) store.changed() identifyChatUser() },