Skip to content

Commit

Permalink
Fixed up loading of flag
Browse files Browse the repository at this point in the history
  • Loading branch information
benjackwhite committed Dec 13, 2024
1 parent 2fb2d20 commit 5040141
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/posthog-featureflags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export class PostHogFeatureFlags {
private _additionalReloadRequested: boolean = false
private _reloadDebouncer?: any
private _decideCalled: boolean = false
private _flagsLoadedFromRemote: boolean = false

constructor(private instance: PostHog) {
this.featureFlagEventHandlers = []
Expand Down Expand Up @@ -257,6 +258,7 @@ export class PostHogFeatureFlags {
return
}

this._flagsLoadedFromRemote = !errorsLoading
this.receivedFeatureFlags(response.json ?? {}, errorsLoading)

if (this._additionalReloadRequested) {
Expand Down Expand Up @@ -303,7 +305,7 @@ export class PostHogFeatureFlags {
$feature_flag_bootstrapped_payload:
this.instance.config.bootstrap?.featureFlagPayloads?.[key] || null,
// If we haven't yet received a response from the /decide endpoint, we must have used the bootstrapped value
$used_bootstrap_value: !this.instance.decideEndpointWasHit,
$used_bootstrap_value: !this._flagsLoadedFromRemote,
})
}
}
Expand Down

0 comments on commit 5040141

Please sign in to comment.