Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(feature-flags): v3 feature flag payloads #50

Merged
merged 9 commits into from
Jan 17, 2023

Conversation

EDsCODE
Copy link
Member

@EDsCODE EDsCODE commented Jan 9, 2023

Two new functions based on PostHog/posthog#13580:

getFeatureFlagPayloads(): PostHogDecideResponse['featureFlagPayloads'] | undefined — returns all matched flag payloads
getFeatureFlagPayload(key:string): JsonType | undefined — return only the payload of the flag requested in parameter

@EDsCODE EDsCODE marked this pull request as ready for review January 9, 2023 22:59
@neilkakkar
Copy link
Contributor

Ah, another part that's missing here, is that we need to add the same handling for local evaluation as well

@EDsCODE EDsCODE changed the title v3 feature flag payloads feat(feature-flags): v3 feature flag payloads Jan 10, 2023
@EDsCODE
Copy link
Member Author

EDsCODE commented Jan 10, 2023

Local eval for node suggestion: #54

@EDsCODE
Copy link
Member Author

EDsCODE commented Jan 17, 2023

Waiting on #53

Copy link
Contributor

@neilkakkar neilkakkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

newFeatureFlagPayloads = { ...currentFlagPayloads, ...res.featureFlagPayloads }
}
this.setKnownFeatureFlagPayloads(newFeatureFlagPayloads)
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need upserting here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Actually, can we not duplicate upserting code and move it into the above? wherever flags are set, set the payloads as well, otherwise don't do anything.

Let's always keep flags response as the source of truth, and payloads just follow whatever happens to flags.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise, will be easy to make these go out of sync, which is terrible :/

@EDsCODE EDsCODE merged commit 3ff3822 into master Jan 17, 2023
@EDsCODE EDsCODE deleted the v3-feature-flag-json-type-2 branch January 17, 2023 15:08
@neilkakkar
Copy link
Contributor

Thinking about this further, wherever we set setKnownFeatureFlags, we should be setting setKnownFlagPayloads, so makes sense to make these private, and the public one takes both.

Extending this thought further, sounds like we need to add payloads to bootstrapping as well, which makes sense 😅 - so a getAllFlags companion, getAllFlagPayloads, will help populate these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants