@harnessio/ff-react-client-sdk
Advanced tools
Comparing version
{ | ||
"name": "@harnessio/ff-react-client-sdk", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"author": "Harness", | ||
@@ -24,3 +24,3 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@harnessio/ff-javascript-client-sdk": "^1.29.0", | ||
"@harnessio/ff-javascript-client-sdk": "^1.30.0", | ||
"lodash.omit": "^4.5.0" | ||
@@ -27,0 +27,0 @@ }, |
@@ -108,10 +108,10 @@ # React.js Client SDK For Harness Feature Flags | ||
## On Flag Not Found | ||
The `onFlagNotFound` option allows you to handle situations where a default variation is returned. | ||
It includes the flag, variation, and whether the SDK was still initializing (`loading)` when the default was served. | ||
The `onFlagNotFound` option allows you to handle situations where a default variation is returned. | ||
It includes the flag, variation, and whether the SDK was still initializing (`loading`) when the default was served. | ||
This can happen when: | ||
1. Using `asyncMode` mode without `cache` or `initialEvaluations` and where the SDK is still initializing. | ||
1. Using `asyncMode` mode without `cache` or `initialEvaluations` and where the SDK is still initializing. | ||
2. The flag identifier is incorrect (e.g., due to a typo). | ||
@@ -129,5 +129,9 @@ 3. The wrong API key is being used, and the expected flags are not available for that project. | ||
if (loading) { | ||
console.debug(`Flag "${flagNotFound.flag}" not found because the SDK is still initializing. Returned default: ${flagNotFound.defaultVariation}`); | ||
console.debug( | ||
`Flag "${flagNotFound.flag}" not found because the SDK is still initializing. Returned default: ${flagNotFound.defaultVariation}` | ||
) | ||
} else { | ||
console.warn(`Flag "${flagNotFound.flag}" not found. Returned default: ${flagNotFound.defaultVariation}`); | ||
console.warn( | ||
`Flag "${flagNotFound.flag}" not found. Returned default: ${flagNotFound.defaultVariation}` | ||
) | ||
} | ||
@@ -138,6 +142,6 @@ }} | ||
</FFContextProvider> | ||
``` | ||
By using the `onFlagNotFound` prop, your application can be notified whenever a flag is missing and the default variation has been returned. | ||
By using the `onFlagNotFound` prop, your application can be notified whenever a flag is missing and the default | ||
variation has been returned. | ||
@@ -176,2 +180,8 @@ ## Caching evaluations | ||
storage?: AsyncStorage | SyncStorage | ||
// use target attributes when deriving the cache key | ||
// when set to `false` or omitted, the key will be formed using only the target identifier and SDK key | ||
// when set to `true`, all target attributes with be used in addition to the target identifier and SDK key | ||
// can be set to an array of target attributes to use a subset in addition to the target identifier and SDK key | ||
// defaults to false | ||
deriveKeyFromTargetAttributes?: boolean | string[] | ||
} | ||
@@ -239,3 +249,4 @@ | ||
The `FFContextProvider` component also accepts an `options` object, a `fallback` component, an array | ||
of `initialEvaluations`, an `onError` handler, and can be placed in [Async mode](#Async-mode) using the `asyncMode` prop. | ||
of `initialEvaluations`, an `onError` handler, and can be placed in [Async mode](#Async-mode) using the `asyncMode` | ||
prop. | ||
The `fallback` component will be displayed while the SDK is connecting and fetching your flags. The `initialEvaluations` | ||
@@ -242,0 +253,0 @@ prop allows you pass an array of evaluations to use immediately as the SDK is authenticating and fetching flags. |
73996
0.66%584
1.92%