splitio / react-client

React JS SDK client for Split Software
https://split.io
Other
27 stars 10 forks source link

Added update options to hooks #152

Closed EmilianoSanchez closed 1 year ago

EmilianoSanchez commented 1 year ago

React SDK

What did you accomplish?

Added update options to hooks, similar to components, to customize the default behavior regarding updates.

For example, by default useSplitTreatments(['feature_flag_name'], attributes, userKey) will re-evaluate the feature flag when the SDK client is ready or ready from cache, but not when it is updated. To change this, call it as follows: useSplitTreatments(['feature_flag_name'], attributes, userKey, { updateOnSdkUpdate: true }).

How do we test the changes introduced in this PR?

Added new asserts to unit tests.

Extra Notes