feat: skip exposure event for disabled flags in getExperimentFlag#403
Conversation
There was a problem hiding this comment.
Code Review
This pull request modifies getExperimentFlag to skip tracking exposure events when the flag is disabled, ensuring cleaner experimentation data. It also adds a corresponding unit test and updates the documentation. The feedback suggests simplifying the condition in flagsmith-core.ts by using optional chaining (flag?.enabled) to make the code more concise and idiomatic.
2721d6d to
f27dbb0
Compare
getExperimentFlag no longer fires a $flag_exposure event when the resolved flag is disabled, even if it has a variant, keeping experimentation data clean. The flag is still returned to the caller.
f27dbb0 to
7780eb1
Compare
|
@gemini-code-assist review |
There was a problem hiding this comment.
Code Review
This pull request updates the getExperimentFlag method in flagsmith-core.ts to skip recording exposure events and return the flag if the flag is disabled. It also adds a corresponding test case and test data to verify this behavior. There are no review comments to address, and I have no additional feedback to provide.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
getExperimentFlagno longer fires a$flag_exposureevent when the resolved flag is disabled, keeping experimentation data clean. The flag is still returned unchanged — only the exposure event is skipped.How did you test this code?
Added a unit test in
test/events.test.ts(disabledoff_valuefixture): asserts the flag is returned and no event is flushed. Full suite green.