posthog-js icon indicating copy to clipboard operation
posthog-js copied to clipboard

feat(nuxt): Added feature flag composables

Open geferon opened this issue 2 months ago • 11 comments

Problem

Currently the Nuxt module is pretty barebones, and one major feature of Posthog imo is feature flags, so I am creating a PR to add some useful composables starting with feature flags.

Changes

Added 4 Nuxt Composables:

  • usePostHog(): posthog | undefined
  • useFeatureFlagEnabled(flag: string): Ref<boolean | undefined>
  • useFeatureFlagPayload(flag: string): Ref<JsonType>
  • useFeatureFlagVariantKey(flag: string): Ref<string | boolean | undefined>

Release info Sub-libraries affected

Libraries affected

  • [ ] All of them
  • [ ] posthog-js (web)
  • [ ] posthog-js-lite (web lite)
  • [ ] posthog-node
  • [ ] posthog-react-native
  • [ ] @posthog/react
  • [ ] @posthog/ai
  • [ ] @posthog/nextjs-config
  • [x] @posthog/nuxt

Checklist

  • [x] Tests for new code
  • [ ] Accounted for the impact of any changes across different platforms
  • [x] Accounted for backwards compatibility of any changes (no breaking changes!)
  • [x] Took care not to unnecessarily increase the bundle size

If releasing new changes

  • [x] Ran pnpm changeset to generate a changeset file
  • [ ] Added the "release" label to the PR to indicate we're publishing new versions for the affected packages

geferon avatar Nov 14 '25 01:11 geferon

@geferon is attempting to deploy a commit to the PostHog Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Nov 14 '25 01:11 vercel[bot]

I haven't created a changeset because I'm wondering if this should be a minor or a major bump. Hope this is helpful...

geferon avatar Nov 14 '25 01:11 geferon

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

posthog-bot avatar Nov 24 '25 09:11 posthog-bot

It would be nice if it would be checked out and merged, since this functionality would be nice Nuxt features to have

geferon avatar Nov 24 '25 11:11 geferon

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

posthog-bot avatar Dec 02 '25 09:12 posthog-bot

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

posthog-bot avatar Dec 11 '25 09:12 posthog-bot

Still waiting for a review/response, so please don't stale it bot :)

geferon avatar Dec 11 '25 16:12 geferon

Tagging @dmarticus

ablaszkiewicz avatar Dec 12 '25 09:12 ablaszkiewicz

Many thanks!

geferon avatar Dec 12 '25 16:12 geferon

@geferon FYI; I think we're having some build issues for this contribution (nothing to do with your changes, just how our CI interacts with external branches), so in the name of getting this change into our SDK as quickly as possible I'm going to port these changes to my own branch and get it merged. Sorry for the delay!

dmarticus avatar Dec 16 '25 19:12 dmarticus

reimplemented this changes here: https://github.com/PostHog/posthog-js/pull/2778

dmarticus avatar Dec 16 '25 21:12 dmarticus