Skip to content

Commit 62cc059

Browse files
PostHog Feature Flag Fix (#201)
* Try this fix * Change isFeature to getFeature * Fix Lint Errors
1 parent 5934915 commit 62cc059

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

modules/posthog/runtime/composables/usePostHogFeatureFlag.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useState } from '#app';
22
import type { JsonType } from 'posthog-js';
33

44
export default () => {
5+
const { $posthog } = useNuxtApp();
56
const posthogFeatureFlags = useState<Record<string, boolean | string> | undefined>('ph-feature-flags');
67
const posthogFeatureFlagPayloads = useState<Record<string, JsonType> | undefined>('ph-feature-flag-payloads');
78

@@ -10,6 +11,10 @@ export default () => {
1011
};
1112

1213
const getFeatureFlag = (feature: string) => {
14+
if ($posthog) {
15+
$posthog.getFeatureFlag(feature);
16+
}
17+
1318
return {
1419
value: posthogFeatureFlags.value?.[feature] ?? false,
1520
payload: posthogFeatureFlagPayloads.value?.[feature],

0 commit comments

Comments
 (0)