Skip to content

Commit d9611e4

Browse files
authored
chore: [FFM-12313]: Update Javascript SDK (#24)
1 parent a4d1760 commit d9611e4

File tree

3 files changed

+32
-20
lines changed

3 files changed

+32
-20
lines changed

README.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ may be beneficial to immediately render the application and handle display of lo
105105
The 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

113113
This 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.
116116
2. The flag identifier is incorrect (e.g., due to a typo).
117117
3. 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

175185
interface SyncStorage {
@@ -232,7 +242,8 @@ using the `useFeatureFlag` and `useFeatureFlags` hooks and `withFeatureFlags`
232242
your Harness Feature Flags account, and the `target`. You can think of a `target` as a user.
233243

234244
The `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.
236247
The `fallback` component will be displayed while the SDK is connecting and fetching your flags. The `initialEvaluations`
237248
prop allows you pass an array of evaluations to use immediately as the SDK is authenticating and fetching flags.
238249
The `onError` prop allows you to pass an event handler which will be called whenever a network error occurs.

package-lock.json

Lines changed: 10 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@harnessio/ff-react-client-sdk",
3-
"version": "2.0.0",
3+
"version": "2.1.0",
44
"author": "Harness",
55
"license": "Apache-2.0",
66
"module": "dist/esm/index.js",
@@ -21,7 +21,7 @@
2121
"react": ">=16.7.0"
2222
},
2323
"dependencies": {
24-
"@harnessio/ff-javascript-client-sdk": "^1.29.0",
24+
"@harnessio/ff-javascript-client-sdk": "^1.30.0",
2525
"lodash.omit": "^4.5.0"
2626
},
2727
"devDependencies": {

0 commit comments

Comments
 (0)