From fe1b56eb599e5a680735178b908a0af6164fec4e Mon Sep 17 00:00:00 2001 From: Rafa Audibert Date: Fri, 13 Dec 2024 14:44:02 -0300 Subject: [PATCH] fix: Make legacy property sturdier 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) --- src/posthog-core.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/posthog-core.ts b/src/posthog-core.ts index 9be84c556..cbd4e6d7b 100644 --- a/src/posthog-core.ts +++ b/src/posthog-core.ts @@ -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 */