@@ -105,14 +105,14 @@ may be beneficial to immediately render the application and handle display of lo
105105The React Client SDK's asynchronous mode allows this by passing the optional ` asyncMode ` prop when connecting with the
106106` FFContextProvider ` .
107107
108-
109108## On Flag Not Found
110- The ` onFlagNotFound ` option allows you to handle situations where a default variation is returned.
111- It includes the flag, variation, and whether the SDK was still initializing (` loading) ` when the default was served.
109+
110+ The ` onFlagNotFound ` option allows you to handle situations where a default variation is returned.
111+ It includes the flag, variation, and whether the SDK was still initializing (` loading ` ) when the default was served.
112112
113113This can happen when:
114114
115- 1 . Using ` asyncMode ` mode without ` cache ` or ` initialEvaluations ` and where the SDK is still initializing.
115+ 1 . Using ` asyncMode ` mode without ` cache ` or ` initialEvaluations ` and where the SDK is still initializing.
1161162 . The flag identifier is incorrect (e.g., due to a typo).
1171173 . The wrong API key is being used, and the expected flags are not available for that project.
118118
@@ -125,18 +125,22 @@ This can happen when:
125125 }}
126126 onFlagNotFound = {(flagNotFoundPayload , loading) => {
127127 if (loading ) {
128- console .debug (` Flag "${flagNotFound .flag }" not found because the SDK is still initializing. Returned default: ${flagNotFound .defaultVariation } ` );
128+ console .debug (
129+ ` Flag "${flagNotFound .flag }" not found because the SDK is still initializing. Returned default: ${flagNotFound .defaultVariation } `
130+ )
129131 } else {
130- console .warn (` Flag "${flagNotFound .flag }" not found. Returned default: ${flagNotFound .defaultVariation } ` );
132+ console .warn (
133+ ` Flag "${flagNotFound .flag }" not found. Returned default: ${flagNotFound .defaultVariation } `
134+ )
131135 }
132136 }}
133137>
134138 < MyApp / >
135139< / FFContextProvider >
136-
137140```
138141
139- By using the ` onFlagNotFound ` prop, your application can be notified whenever a flag is missing and the default variation has been returned.
142+ By using the ` onFlagNotFound ` prop, your application can be notified whenever a flag is missing and the default
143+ variation has been returned.
140144
141145## Caching evaluations
142146
@@ -170,6 +174,12 @@ interface CacheOptions {
170174 // storage mechanism to use, conforming to the Web Storage API standard, can be either synchronous or asynchronous
171175 // defaults to localStorage
172176 storage? : AsyncStorage | SyncStorage
177+ // use target attributes when deriving the cache key
178+ // when set to `false` or omitted, the key will be formed using only the target identifier and SDK key
179+ // when set to `true`, all target attributes with be used in addition to the target identifier and SDK key
180+ // can be set to an array of target attributes to use a subset in addition to the target identifier and SDK key
181+ // defaults to false
182+ deriveKeyFromTargetAttributes? : boolean | string []
173183}
174184
175185interface SyncStorage {
@@ -232,7 +242,8 @@ using the `useFeatureFlag` and `useFeatureFlags` hooks and `withFeatureFlags`
232242your Harness Feature Flags account, and the ` target ` . You can think of a ` target ` as a user.
233243
234244The ` FFContextProvider ` component also accepts an ` options ` object, a ` fallback ` component, an array
235- of ` initialEvaluations ` , an ` onError ` handler, and can be placed in [ Async mode] ( #Async-mode ) using the ` asyncMode ` prop.
245+ of ` initialEvaluations ` , an ` onError ` handler, and can be placed in [ Async mode] ( #Async-mode ) using the ` asyncMode `
246+ prop.
236247The ` fallback ` component will be displayed while the SDK is connecting and fetching your flags. The ` initialEvaluations `
237248prop allows you pass an array of evaluations to use immediately as the SDK is authenticating and fetching flags.
238249The ` onError ` prop allows you to pass an event handler which will be called whenever a network error occurs.
0 commit comments