Skip to content

Commit

Permalink
chore: update sdk readmes (#554)
Browse files Browse the repository at this point in the history
Signed-off-by: OpenFeature Bot <[email protected]>
  • Loading branch information
openfeaturebot authored May 15, 2024
1 parent 402bb78 commit bdc3e8a
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 37 deletions.
2 changes: 1 addition & 1 deletion docs/reference/technologies/client/kotlin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from kotlin-sdk.
Edits should be made here: https://github.com/open-feature/kotlin-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

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

<p align="center" class="github-badges">
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/technologies/client/swift.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from swift-sdk.
Edits should be made here: https://github.com/open-feature/swift-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

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

<p align="center" class="github-badges">
Expand Down
35 changes: 30 additions & 5 deletions docs/reference/technologies/client/web/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

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

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

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

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

```ts
await OpenFeature.setProviderAndWait(new MyProvider());
```
```

#### Synchronous

Expand Down Expand Up @@ -155,9 +155,16 @@ Sometimes, the value of a flag must consider some dynamic criteria about the app
In OpenFeature, we refer to this as [targeting](/specification/glossary#targeting).
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).

```ts
// Sets global context during provider registration
await OpenFeature.setProvider(new MyProvider(), { origin: document.location.host });
```

Change context after the provider has been registered using `setContext`.

```ts
// Set a value to the global context
await OpenFeature.setContext({ origin: document.location.host });
await OpenFeature.setContext({ targetingKey: localStorage.getItem("targetingKey") });
```

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

#### Manage evaluation context for domains

By default, domain-scoped clients use the global context.
This can be overridden by explicitly setting context when registering the provider or by references the domain when updating context:

```ts
OpenFeature.setProvider("my-domain", new NewCachedProvider(), { targetingKey: localStorage.getItem("targetingKey") });
```

To change context after the provider has been registered, use `setContext` with a name:

```ts
await OpenFeature.setContext("my-domain", { targetingKey: localStorage.getItem("targetingKey") })
```

Once context has been defined for a named client, it will override the global context for all clients using the associated provider.
Context can be cleared using for a named provider using `OpenFeature.clearContext("my-domain")` or call `OpenFeature.clearContexts()` to reset all context.

### Eventing

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.
Expand Down
39 changes: 26 additions & 13 deletions docs/reference/technologies/client/web/react.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

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

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

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

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

```tsx
function Page() {
const showNewMessage = useBooleanFlagValue('new-message', false, { updateOnContextChanged: false });
const { value: showNewMessage } = useFlag('new-message', false, { updateOnContextChanged: false });
return (
<MyComponents></MyComponents>
)
<div className="App">
<header className="App-header">
{showNewMessage ? <p>Welcome to this OpenFeature-enabled React app!</p> : <p>Welcome to this React app.</p>}
</header>
</div>
);
}
```

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

```tsx
function Page() {
const showNewMessage = useBooleanFlagValue('new-message', false, { updateOnConfigurationChanged: false });
const { value: showNewMessage } = useFlag('new-message', false, { updateOnConfigurationChanged: false });
return (
<MyComponents></MyComponents>
)
<div className="App">
<header className="App-header">
{showNewMessage ? <p>Welcome to this OpenFeature-enabled React app!</p> : <p>Welcome to this React app.</p>}
</header>
</div>
);
}
```

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

#### Suspense Support

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

```tsx
function Content() {
Expand All @@ -239,8 +251,8 @@ function Content() {
}

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

return (
<>
Expand Down Expand Up @@ -268,8 +280,9 @@ This can be disabled in the hook options (or in the [OpenFeatureProvider](#openf
The OpenFeature React SDK features built-in [suspense support](#suspense-support).
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!
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.
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).
If you use suspense and neglect to create a suspense boundary around any components using feature flags, you will see this error.
Add a suspense boundary to resolve this issue.
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).

> I get odd rendering issues, or errors when components mount, if I use the suspense features.
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/technologies/server/dotnet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from dotnet-sdk.
Edits should be made here: https://github.com/open-feature/dotnet-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

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

[![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)
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/technologies/server/go.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from go-sdk.
Edits should be made here: https://github.com/open-feature/go-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

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

<p align="center" class="github-badges">
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/technologies/server/java.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from java-sdk.
Edits should be made here: https://github.com/open-feature/java-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

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

<p align="center" class="github-badges">
Expand Down
11 changes: 7 additions & 4 deletions docs/reference/technologies/server/javascript/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

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

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

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

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

### Requirements

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

### Install

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

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

### Hooks

[Hooks](/docs/reference/concepts/hooks) allow for custom logic to be added at well-defined points of the flag evaluation life-cycle.
Expand Down
8 changes: 4 additions & 4 deletions docs/reference/technologies/server/javascript/nestjs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

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

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

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

<br/>
Expand Down Expand Up @@ -47,7 +47,7 @@ Capabilities include:

### Requirements

- Node.js version 16+
- Node.js version 18+
- NestJS version 8+

### Install
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/technologies/server/php.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from php-sdk.
Edits should be made here: https://github.com/open-feature/php-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

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

<p align="center" class="github-badges">
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/technologies/server/python.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from python-sdk.
Edits should be made here: https://github.com/open-feature/python-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

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

<p align="center" class="github-badges">
Expand Down
8 changes: 4 additions & 4 deletions src/datasets/sdks/sdk-compatibility.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
"path": "/docs/reference/technologies/server/javascript",
"category": "Server",
"release": {
"href": "https://github.com/open-feature/js-sdk/releases/tag/server-sdk-v1.13.5",
"version": "1.13.5",
"href": "https://github.com/open-feature/js-sdk/releases/tag/server-sdk-v1.14.0",
"version": "1.14.0",
"stable": true
},
"spec": {
Expand Down Expand Up @@ -316,8 +316,8 @@
"path": "/docs/reference/technologies/client/web",
"category": "Client",
"release": {
"href": "https://github.com/open-feature/js-sdk/releases/tag/web-sdk-v1.0.3",
"version": "1.0.3",
"href": "https://github.com/open-feature/js-sdk/releases/tag/web-sdk-v1.1.0",
"version": "1.1.0",
"stable": true
},
"spec": {
Expand Down

0 comments on commit bdc3e8a

Please sign in to comment.