You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: useExperiment hook rerenders when client setForcedVariation is called (#97)
Summary:
Add mechanism in client to subscribe to setForcedVariation calls. In useExperiment, subscribe and re-compute decision after setForcedVariation is called.
Test plan:
- New unit tests
- Manual testing
Copy file name to clipboardExpand all lines: README.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -491,7 +491,7 @@ The following type definitions are used in the `ReactSDKClient` interface:
491
491
-`isFeatureEnabled(featureKey: string, overrideUserId?: string, overrideAttributes?: UserAttributes): boolean` Return the enabled status for the given feature and user
492
492
-`getEnabledFeatures(overrideUserId?: string, overrideAttributes?: UserAttributes): Array<string>`: Return the keys of all features enabled for the given user
493
493
-`track(eventKey: string, overrideUserId?: string | EventTags, overrideAttributes?: UserAttributes, eventTags?: EventTags): void` Track an event to the Optimizely results backend
494
-
-`setForcedVariation(experiment: string, overrideUserIdOrVariationKey: string, variationKey?: string | null): boolean` Set a forced variation for the given experiment, variation, and user
494
+
-`setForcedVariation(experiment: string, overrideUserIdOrVariationKey: string, variationKey?: string | null): boolean` Set a forced variation for the given experiment, variation, and user. **Note**: calling `setForcedVariation` on a given client will trigger a re-render of all `useExperiment` hooks and `OptimizelyExperiment` components that are using that client.
495
495
-`getForcedVariation(experiment: string, overrideUserId?: string): string | null` Get the forced variation for the given experiment, variation, and user
496
496
497
497
## Rollout or experiment a feature user-by-user
@@ -586,60 +586,60 @@ First-party code subject to copyrights held by Optimizely, Inc. and its contribu
586
586
587
587
This repository includes the following third party open source code:
0 commit comments