Skip to content

Commit

Permalink
fix: Make legacy property sturdier
Browse files Browse the repository at this point in the history
This property might be accessed/called before we've properly initialized feature flags, so let's make sure we're not breaking anything (we have broken it already, see https://posthog.slack.com/archives/C02E3BKC78F/p1734111258352399)
  • Loading branch information
rafaeelaudibert committed Dec 13, 2024
1 parent 522c9f1 commit fe1b56e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/posthog-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export class PostHog {

// Legacy property to support existing usage - this isn't technically correct but it's what it has always been - a proxy for flags being loaded
public get decideEndpointWasHit(): boolean {
return this.featureFlags.hasLoadedFlags
return this.featureFlags?.hasLoadedFlags ?? false
}

/** DEPRECATED: We keep this to support existing usage but now one should just call .setPersonProperties */
Expand Down

0 comments on commit fe1b56e

Please sign in to comment.