Skip to content

Commit bdc3e8a

Browse files
chore: update sdk readmes (#554)
Signed-off-by: OpenFeature Bot <[email protected]>
1 parent 402bb78 commit bdc3e8a

File tree

12 files changed

+78
-37
lines changed

12 files changed

+78
-37
lines changed

docs/reference/technologies/client/kotlin.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This content has been automatically generated from kotlin-sdk.
1010
Edits should be made here: https://github.com/open-feature/kotlin-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Tue May 07 2024 20:53:29 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Wed May 15 2024 08:07:55 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
<p align="center" class="github-badges">

docs/reference/technologies/client/swift.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This content has been automatically generated from swift-sdk.
1010
Edits should be made here: https://github.com/open-feature/swift-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Tue May 07 2024 20:53:29 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Wed May 15 2024 08:07:55 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
<p align="center" class="github-badges">

docs/reference/technologies/client/web/index.mdx

+30-5
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ This content has been automatically generated from js-sdk.
1010
Edits should be made here: https://github.com/open-feature/js-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Tue May 07 2024 20:53:28 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Wed May 15 2024 08:07:55 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
<p align="center" class="github-badges">
1717
<a href="https://github.com/open-feature/spec/releases/tag/v0.8.0">
1818
<img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.8.0&color=yellow&style=for-the-badge" />
1919
</a>
2020

21-
<a href="https://github.com/open-feature/js-sdk/releases/tag/web-sdk-v1.0.3">
22-
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.0.3&color=blue&style=for-the-badge" />
21+
<a href="https://github.com/open-feature/js-sdk/releases/tag/web-sdk-v1.1.0">
22+
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.1.0&color=blue&style=for-the-badge" />
2323
</a>
2424

2525
<br/>
@@ -118,7 +118,7 @@ To register a provider and ensure it is ready before further actions are taken,
118118

119119
```ts
120120
await OpenFeature.setProviderAndWait(new MyProvider());
121-
```
121+
```
122122

123123
#### Synchronous
124124

@@ -155,9 +155,16 @@ Sometimes, the value of a flag must consider some dynamic criteria about the app
155155
In OpenFeature, we refer to this as [targeting](/specification/glossary#targeting).
156156
If the flag management system you're using supports targeting, you can provide the input data using the [evaluation context](/docs/reference/concepts/evaluation-context).
157157

158+
```ts
159+
// Sets global context during provider registration
160+
await OpenFeature.setProvider(new MyProvider(), { origin: document.location.host });
161+
```
162+
163+
Change context after the provider has been registered using `setContext`.
164+
158165
```ts
159166
// Set a value to the global context
160-
await OpenFeature.setContext({ origin: document.location.host });
167+
await OpenFeature.setContext({ targetingKey: localStorage.getItem("targetingKey") });
161168
```
162169

163170
Context is global and setting it is `async`.
@@ -230,6 +237,24 @@ const domainScopedClient = OpenFeature.getClient("my-domain");
230237
Domains can be defined on a provider during registration.
231238
For more details, please refer to the [providers](#providers) section.
232239

240+
#### Manage evaluation context for domains
241+
242+
By default, domain-scoped clients use the global context.
243+
This can be overridden by explicitly setting context when registering the provider or by references the domain when updating context:
244+
245+
```ts
246+
OpenFeature.setProvider("my-domain", new NewCachedProvider(), { targetingKey: localStorage.getItem("targetingKey") });
247+
```
248+
249+
To change context after the provider has been registered, use `setContext` with a name:
250+
251+
```ts
252+
await OpenFeature.setContext("my-domain", { targetingKey: localStorage.getItem("targetingKey") })
253+
```
254+
255+
Once context has been defined for a named client, it will override the global context for all clients using the associated provider.
256+
Context can be cleared using for a named provider using `OpenFeature.clearContext("my-domain")` or call `OpenFeature.clearContexts()` to reset all context.
257+
233258
### Eventing
234259

235260
Events allow you to react to state changes in the provider or underlying flag management system, such as flag definition changes, provider readiness, or error conditions.

docs/reference/technologies/client/web/react.mdx

+26-13
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ This content has been automatically generated from js-sdk.
1010
Edits should be made here: https://github.com/open-feature/js-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Tue May 07 2024 20:53:28 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Wed May 15 2024 08:07:55 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
<p align="center" class="github-badges">
1717
<a href="https://github.com/open-feature/spec/releases/tag/v0.8.0">
1818
<img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.8.0&color=yellow&style=for-the-badge" />
1919
</a>
2020

21-
<a href="https://github.com/open-feature/js-sdk/releases/tag/react-sdk-v0.3.4">
22-
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.3.4&color=blue&style=for-the-badge" />
21+
<a href="https://github.com/open-feature/js-sdk/releases/tag/react-sdk-v0.4.0">
22+
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.4.0&color=blue&style=for-the-badge" />
2323
</a>
2424

2525
<br/>
@@ -196,10 +196,14 @@ You can disable this feature in the hook options (or in the [OpenFeatureProvider
196196

197197
```tsx
198198
function Page() {
199-
const showNewMessage = useBooleanFlagValue('new-message', false, { updateOnContextChanged: false });
199+
const { value: showNewMessage } = useFlag('new-message', false, { updateOnContextChanged: false });
200200
return (
201-
<MyComponents></MyComponents>
202-
)
201+
<div className="App">
202+
<header className="App-header">
203+
{showNewMessage ? <p>Welcome to this OpenFeature-enabled React app!</p> : <p>Welcome to this React app.</p>}
204+
</header>
205+
</div>
206+
);
203207
}
204208
```
205209

@@ -213,20 +217,28 @@ You can disable this feature in the hook options (or in the [OpenFeatureProvider
213217

214218
```tsx
215219
function Page() {
216-
const showNewMessage = useBooleanFlagValue('new-message', false, { updateOnConfigurationChanged: false });
220+
const { value: showNewMessage } = useFlag('new-message', false, { updateOnConfigurationChanged: false });
217221
return (
218-
<MyComponents></MyComponents>
219-
)
222+
<div className="App">
223+
<header className="App-header">
224+
{showNewMessage ? <p>Welcome to this OpenFeature-enabled React app!</p> : <p>Welcome to this React app.</p>}
225+
</header>
226+
</div>
227+
);
220228
}
221229
```
222230

223231
Note that if your provider doesn't support updates, this configuration has no impact.
224232

225233
#### Suspense Support
226234

235+
> [!NOTE]
236+
> React suspense is an experimental feature and subject to change in future versions.
237+
227238
Frequently, providers need to perform some initial startup tasks.
228239
It may be desireable not to display components with feature flags until this is complete, or when the context changes.
229240
Built-in [suspense](https://react.dev/reference/react/Suspense) support makes this easy.
241+
Use `useSuspenseFlag` or pass `{ suspend: true }` in the hook options to leverage this functionality.
230242

231243
```tsx
232244
function Content() {
@@ -239,8 +251,8 @@ function Content() {
239251
}
240252

241253
function Message() {
242-
// component to render after READY.
243-
const showNewMessage = useBooleanFlagValue('new-message', false);
254+
// component to render after READY, equivalent to useFlag('new-message', false, { suspend: true });
255+
const { value: showNewMessage } = useSuspenseFlag('new-message', false);
244256

245257
return (
246258
<>
@@ -268,8 +280,9 @@ This can be disabled in the hook options (or in the [OpenFeatureProvider](#openf
268280
269281
The OpenFeature React SDK features built-in [suspense support](#suspense-support).
270282
This means that it will render your loading fallback automatically while the your provider starts up, and during context reconciliation for any of your components using feature flags!
271-
However, you will see this error if you neglect to create a suspense boundary around any components using feature flags; add a suspense boundary to resolve this issue.
272-
Alternatively, you can disable this feature by setting `suspendWhileReconciling=false` and `suspendUntilReady=false` in the [evaluation hooks](#evaluation-hooks) or the [OpenFeatureProvider](#openfeatureprovider-context-provider) (which applies to all evaluation hooks in child components).
283+
If you use suspense and neglect to create a suspense boundary around any components using feature flags, you will see this error.
284+
Add a suspense boundary to resolve this issue.
285+
Alternatively, you can disable this suspense (the default) by removing `suspendWhileReconciling=true`, `suspendUntilReady=true` or `suspend=true` in the [evaluation hooks](#evaluation-hooks) or the [OpenFeatureProvider](#openfeatureprovider-context-provider) (which applies to all evaluation hooks in child components).
273286

274287
> I get odd rendering issues, or errors when components mount, if I use the suspense features.
275288

docs/reference/technologies/server/dotnet.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This content has been automatically generated from dotnet-sdk.
1010
Edits should be made here: https://github.com/open-feature/dotnet-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Tue May 07 2024 20:53:27 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Wed May 15 2024 08:07:55 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
[![Specification](https://img.shields.io/static/v1?label=specification&message=v0.7.0&color=yellow&style=for-the-badge)](https://github.com/open-feature/spec/releases/tag/v0.7.0)

docs/reference/technologies/server/go.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This content has been automatically generated from go-sdk.
99
Edits should be made here: https://github.com/open-feature/go-sdk
1010
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1111

12-
Last updated at Tue May 07 2024 20:53:27 GMT+0000 (Coordinated Universal Time)
12+
Last updated at Wed May 15 2024 08:07:55 GMT+0000 (Coordinated Universal Time)
1313
-->
1414

1515
<p align="center" class="github-badges">

docs/reference/technologies/server/java.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This content has been automatically generated from java-sdk.
99
Edits should be made here: https://github.com/open-feature/java-sdk
1010
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1111

12-
Last updated at Tue May 07 2024 20:53:27 GMT+0000 (Coordinated Universal Time)
12+
Last updated at Wed May 15 2024 08:07:55 GMT+0000 (Coordinated Universal Time)
1313
-->
1414

1515
<p align="center" class="github-badges">

docs/reference/technologies/server/javascript/index.mdx

+7-4
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ This content has been automatically generated from js-sdk.
1010
Edits should be made here: https://github.com/open-feature/js-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Tue May 07 2024 20:53:27 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Wed May 15 2024 08:07:55 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
<p align="center" class="github-badges">
1717
<a href="https://github.com/open-feature/spec/releases/tag/v0.8.0">
1818
<img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.8.0&color=yellow&style=for-the-badge" />
1919
</a>
2020

21-
<a href="https://github.com/open-feature/js-sdk/releases/tag/server-sdk-v1.13.5">
22-
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.13.5&color=blue&style=for-the-badge" />
21+
<a href="https://github.com/open-feature/js-sdk/releases/tag/server-sdk-v1.14.0">
22+
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.14.0&color=blue&style=for-the-badge" />
2323
</a>
2424

2525
<br/>
@@ -41,7 +41,7 @@ Last updated at Tue May 07 2024 20:53:27 GMT+0000 (Coordinated Universal Time)
4141

4242
### Requirements
4343

44-
- Node.js version 16+
44+
- Node.js version 18+
4545

4646
### Install
4747

@@ -158,6 +158,9 @@ const requestContext = {
158158
const boolValue = await client.getBooleanValue('some-flag', false, requestContext);
159159
```
160160

161+
Context is merged by the SDK before a flag evaluation occurs.
162+
The merge order is defined [here](/specification/sections/evaluation-context#requirement-323) in the OpenFeature specification.
163+
161164
### Hooks
162165

163166
[Hooks](/docs/reference/concepts/hooks) allow for custom logic to be added at well-defined points of the flag evaluation life-cycle.

docs/reference/technologies/server/javascript/nestjs.mdx

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ This content has been automatically generated from js-sdk.
1010
Edits should be made here: https://github.com/open-feature/js-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Tue May 07 2024 20:53:27 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Wed May 15 2024 08:07:55 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
<p align="center" class="github-badges">
1717
<a href="https://github.com/open-feature/spec/releases/tag/v0.8.0">
1818
<img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.8.0&color=yellow&style=for-the-badge" />
1919
</a>
2020

21-
<a href="https://github.com/open-feature/js-sdk/releases/tag/nestjs-sdk-v0.1.4-experimental">
22-
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.1.4-experimental&color=blue&style=for-the-badge" />
21+
<a href="https://github.com/open-feature/js-sdk/releases/tag/nestjs-sdk-v0.1.5-experimental">
22+
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.1.5-experimental&color=blue&style=for-the-badge" />
2323
</a>
2424

2525
<br/>
@@ -47,7 +47,7 @@ Capabilities include:
4747

4848
### Requirements
4949

50-
- Node.js version 16+
50+
- Node.js version 18+
5151
- NestJS version 8+
5252

5353
### Install

docs/reference/technologies/server/php.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This content has been automatically generated from php-sdk.
99
Edits should be made here: https://github.com/open-feature/php-sdk
1010
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1111

12-
Last updated at Tue May 07 2024 20:53:28 GMT+0000 (Coordinated Universal Time)
12+
Last updated at Wed May 15 2024 08:07:55 GMT+0000 (Coordinated Universal Time)
1313
-->
1414

1515
<p align="center" class="github-badges">

docs/reference/technologies/server/python.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This content has been automatically generated from python-sdk.
99
Edits should be made here: https://github.com/open-feature/python-sdk
1010
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1111

12-
Last updated at Tue May 07 2024 20:53:28 GMT+0000 (Coordinated Universal Time)
12+
Last updated at Wed May 15 2024 08:07:55 GMT+0000 (Coordinated Universal Time)
1313
-->
1414

1515
<p align="center" class="github-badges">

src/datasets/sdks/sdk-compatibility.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
"path": "/docs/reference/technologies/server/javascript",
5757
"category": "Server",
5858
"release": {
59-
"href": "https://github.com/open-feature/js-sdk/releases/tag/server-sdk-v1.13.5",
60-
"version": "1.13.5",
59+
"href": "https://github.com/open-feature/js-sdk/releases/tag/server-sdk-v1.14.0",
60+
"version": "1.14.0",
6161
"stable": true
6262
},
6363
"spec": {
@@ -316,8 +316,8 @@
316316
"path": "/docs/reference/technologies/client/web",
317317
"category": "Client",
318318
"release": {
319-
"href": "https://github.com/open-feature/js-sdk/releases/tag/web-sdk-v1.0.3",
320-
"version": "1.0.3",
319+
"href": "https://github.com/open-feature/js-sdk/releases/tag/web-sdk-v1.1.0",
320+
"version": "1.1.0",
321321
"stable": true
322322
},
323323
"spec": {

0 commit comments

Comments
 (0)