Skip to content

Commit 5156edd

Browse files
authored
feat: [FFM-6737]: Update JS SDK to 1.9.1 and update docs (#5)
1 parent 3880dcd commit 5156edd

File tree

4 files changed

+37
-14
lines changed

4 files changed

+37
-14
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,28 @@ 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 `async` prop when connecting with the
106106
`FFContextProvider`.
107107

108+
## Caching evaluations
109+
110+
In practice flags rarely change and so it can be useful to cache the last received evaluations from the server to allow
111+
your application to get started as fast as possible. Setting the `cache` option as `true` will allow the SDK to store
112+
its evaluations to `localStorage` and retrieve at startup. This lets the SDK get started near instantly and begin
113+
serving flags, while it carries on authenticating and fetching up-to-date evaluations from the server behind the scenes.
114+
115+
```typescript jsx
116+
<FFContextProvider
117+
apiKey="YOUR_API_KEY"
118+
target={{
119+
identifier: 'reactclientsdk',
120+
name: 'ReactClientSDK'
121+
}}
122+
options={{
123+
cache: true
124+
}}
125+
>
126+
<MyApp />
127+
</FFContextProvider>
128+
```
129+
108130
## API
109131

110132
### `FFContextProvider`
@@ -140,6 +162,7 @@ function MyComponent() {
140162
}}
141163
fallback={<p>Loading ...</p>} // OPTIONAL: component to display when the SDK is connecting
142164
options={{ // OPTIONAL: advanced configuration options
165+
cache: false,
143166
baseUrl: 'https://url-to-access-flags.com',
144167
eventUrl: 'https://url-for-events.com',
145168
streamEnabled: true,

examples/get-started/package-lock.json

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

package-lock.json

Lines changed: 9 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": "1.1.0",
3+
"version": "1.2.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.8.0",
24+
"@harnessio/ff-javascript-client-sdk": "^1.9.1",
2525
"lodash.omit": "^4.5.0"
2626
},
2727
"devDependencies": {

0 commit comments

Comments
 (0)