-
Notifications
You must be signed in to change notification settings - Fork 83
[FSSDK-11823] make Activate listener payload type backwards compatible #1081
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
base: master
Are you sure you want to change the base?
Conversation
017f8b2
to
37d8258
Compare
5d3e45c
to
a3b1912
Compare
e858feb
to
2f090cc
Compare
2f090cc
to
7b5dc43
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 makes the activate listener payload type backwards compatible with v6.0.0 by separating experiment and holdout fields instead of using a union type.
- Separates the experiment field into distinct
experiment
andholdout
fields inActivateListenerPayload
- Adds runtime type checking with
isHoldout
function to properly populate the correct field - Updates notification handling to conditionally set either experiment or holdout based on the decision object type
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
lib/shared_types.ts | Adds isHoldout type guard function to distinguish between experiments and holdouts |
lib/optimizely/index.ts | Updates activate notification logic to separate experiment and holdout into distinct fields |
lib/optimizely/index.tests.js | Updates test expectations to include the new holdout: null field |
lib/optimizely/index.spec.ts | Updates test spy names and adds validation for the new activate notification payload structure |
lib/notification_center/type.ts | Modifies ActivateListenerPayload type to have separate experiment and holdout fields |
lib/feature_toggle.ts | Updates holdout feature toggle and adds conditional type helper |
Comments suppressed due to low confidence (1)
lib/feature_toggle.ts:1
- Import statement references
holdout
andIfActive
from a file that is being modified in this PR. TheIfActive
type is newly added butholdout
is a function, not a type. This import may cause issues if the function is being used as a type in the import context.
/**
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Summary
The current type of activate listener payload is not backwards compatible with the type in v6.0.0. This PR makes it compatible.
Test plan
Issues