-
Notifications
You must be signed in to change notification settings - Fork 176
fix: Respect client sendFeatureFlagEvent
option
#2285
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
Conversation
`getFeatureFlag` and `isFeatureEnabled` now respect the `sendFeatureFlagEvent` client option if not explicitly specified when called.
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, no comments
Size Change: -320 B (-0.01%) Total Size: 5.23 MB
ℹ️ View Unchanged
|
…load` as deprecated This option is not used.
59e96fa
to
dae80f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes inconsistent feature flag event tracking behavior in the Node SDK by ensuring that getFeatureFlag
and isFeatureEnabled
methods respect the global sendFeatureFlagEvent
client option when no method-level override is provided.
- Modified
getFeatureFlag
to use the client'ssendFeatureFlagEvent
option as default instead of always defaulting totrue
- Added comprehensive tests to verify both methods respect the global client option and allow method-level overrides
- Deprecated the non-functional
sendFeatureFlagEvents
option ingetFeatureFlagPayload
method
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
packages/node/src/client.ts | Updates default behavior for sendFeatureFlagEvents to respect client configuration and deprecates unused option |
packages/node/test/posthog-node.spec.ts | Adds comprehensive test coverage for the new behavior with both global and method-level options |
.changeset/thin-pets-cut.md | Documents deprecation of unused sendFeatureFlagEvents option |
.changeset/shaggy-eyes-attack.md | Documents the fix for respecting client sendFeatureFlagEvent option |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Problem
The Node SDK has some inconsistent behavior with feature flag event tracking. The
getFeatureFlag
andisFeatureEnabled
methods were not respecting the globalsendFeatureFlagEvent
client option when no method-level override was provided, always defaulting totrue
instead of using the client configuration.Additionally, the
getFeatureFlagPayload
method included a non-functionalsendFeatureFlagEvents
option that had no effect, potentially causing confusion.Changes
getFeatureFlag
method to respect the globalsendFeatureFlagEvent
client option when no method-levelsendFeatureFlagEvents
option is providedgetFeatureFlag
andisFeatureEnabled
perform the correct behavior when a global client option is used and when a method-level option overrides itsendFeatureFlagEvents
option ingetFeatureFlagPayload
method has been marked as deprecated since it has no intended effectResolves #2282
Release info Sub-libraries affected
Libraries affected
Checklist
If releasing new changes
pnpm changeset
to generate a changeset file