Skip to content

Commit b563f09

Browse files
fix(onboarding): let segment overrides match the entry decision (#8288)
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent b367023 commit b563f09

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

frontend/common/utils/onboardingEntry.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@ export type OnboardingEntryDecision = {
2020
* the logged-in user, and the routing it should have driven has happened.
2121
* Call `persistOnboardingEntry` with an accepted decision.
2222
*/
23-
export async function decideOnboardingEntry(): Promise<OnboardingEntryDecision> {
23+
export async function decideOnboardingEntry(
24+
email?: string,
25+
): Promise<OnboardingEntryDecision> {
26+
// Only used to match segment overrides, not for bucketing. An override on
27+
// another trait needs that trait passed here too.
2428
// @ts-expect-error transient is missing from the SDK's identify type
25-
await flagsmith.identify('', {}, true)
29+
await flagsmith.identify('', email ? { email } : {}, true)
2630
const flag = flagsmith.getExperimentFlag('onboarding_quickstart_flow')
2731
const identifier = flagsmith.getContext().identity?.identifier
2832
const variant: OnboardingVariant =

frontend/web/components/App.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ const App = class extends Component {
163163
// instead of blocking the redirect.
164164
Promise.race([
165165
AccountStore.getUser()?.isGettingStarted
166-
? decideOnboardingEntry().catch(() => null)
166+
? decideOnboardingEntry(AccountStore.getUser()?.email).catch(
167+
() => null,
168+
)
167169
: Promise.resolve(null),
168170
new Promise((resolve) => setTimeout(() => resolve(null), 2000)),
169171
]).then((decision) => {

0 commit comments

Comments
 (0)