PostHog / PostHog/posthog-js

Allow evaluating feature flags with groups

Open
#2,012 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement feature/flags team/feature-flags web
Dominant language
TypeScript
Stars
609
Forks
344
Avg merge
1d 22h
Merged PRs (30d)
312

Description

We don't want to call group() in a global scope, instead in each feature flag evaluation context send whatever groups we think are necessary to be included. Other SDKs (go and posthog-js-lite) allow to send them per feature flag evaluation, but posthog-js doesn't.

useFeatureFlagEnabled(flag, { groups: { organization });
posthog.getFeatureFlag(flag, { groups: { organization });

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementations of useFeatureFlagEnabled and posthog.getFeatureFlag, then trace how each feature flag evaluation receives its options. The work is done when both entry points accept per-evaluation groups consistently with the requested examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
analytics
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.