Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 Thu Oct 17 2024 08:09:42 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Nov 05 2024 18:07:59 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 Thu Oct 17 2024 08:09:42 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Nov 05 2024 18:07:59 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/technologies/client/web/angular.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 Thu Oct 17 2024 08:09:42 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Nov 05 2024 18:07:59 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/angular-sdk-v0.0.4-experimental">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.0.4-experimental&color=blue&style=for-the-badge" />
<a href="https://github.com/open-feature/js-sdk/releases/tag/angular-sdk-v0.0.6-experimental">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.0.6-experimental&color=blue&style=for-the-badge" />
</a>

<br/>
Expand Down
26 changes: 21 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 Thu Oct 17 2024 08:09:42 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Nov 05 2024 18:07:59 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.2.4">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.2.4&color=blue&style=for-the-badge" />
<a href="https://github.com/open-feature/js-sdk/releases/tag/web-sdk-v1.3.1">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.3.1&color=blue&style=for-the-badge" />
</a>

<br/>
Expand Down Expand Up @@ -61,7 +61,7 @@ npm install --save @openfeature/web-sdk
yarn add @openfeature/web-sdk @openfeature/core
```

> [!NOTE]
> [!NOTE]
> `@openfeature/core` contains common components used by all OpenFeature JavaScript implementations.
> Every SDK version has a requirement on a single, specific version of this dependency.
> For more information, and similar implications on libraries developed with OpenFeature see [considerations when extending](#considerations).
Expand Down Expand Up @@ -99,6 +99,7 @@ See [here](https://open-feature.github.io/js-sdk/modules/_openfeature_web_sdk.ht
| ✅ | [Logging](#logging) | Integrate with popular logging packages. |
| ✅ | [Domains](#domains) | Logically bind clients with providers. |
| ✅ | [Eventing](#eventing) | React to state changes in the provider or flag management system. |
| ✅ | [Tracking](#tracking) | Associate user actions with feature flag evaluations, particularly for A/B testing. |
| ✅ | [Shutdown](#shutdown) | Gracefully clean up a provider during application shutdown. |
| ✅ | [Extending](#extending) | Extend OpenFeature with custom providers and hooks. |

Expand Down Expand Up @@ -278,6 +279,21 @@ client.addHandler(ProviderEvents.Error, (eventDetails) => {
});
```

### Tracking

The tracking API allows you to use OpenFeature abstractions and objects to associate user actions with feature flag evaluations.
This is essential for robust experimentation powered by feature flags.
For example, a flag enhancing the appearance of a UI component might drive user engagement to a new feature; to test this hypothesis, telemetry collected by a [hook](#hooks) or [provider](#providers) can be associated with telemetry reported in the client's `track` function.

```ts
// flag is evaluated
client.getBooleanValue('new-feature', false);

// new feature is used and track function is called recording the usage
useNewFeature();
client.track('new-feature-used');
```

### Shutdown

The OpenFeature API provides a close function to perform a cleanup of all registered providers.
Expand Down Expand Up @@ -336,7 +352,7 @@ class MyProvider implements Provider {
}

// implement with "new OpenFeatureEventEmitter()", and use "emit()" to emit events
events?: ProviderEventEmitter<AnyProviderEvent> | undefined;
events?: ProviderEventEmitter<AnyProviderEvent> | undefined;

initialize?(context?: EvaluationContext | undefined): Promise<void> {
// code to initialize your provider
Expand Down
51 changes: 36 additions & 15 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 Thu Oct 17 2024 08:09:42 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Nov 05 2024 18:07:59 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.4.6">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.4.6&color=blue&style=for-the-badge" />
<a href="https://github.com/open-feature/js-sdk/releases/tag/react-sdk-v0.4.8">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.4.8&color=blue&style=for-the-badge" />
</a>

<br/>
Expand Down Expand Up @@ -51,6 +51,7 @@ In addition to the feature provided by the [web sdk](/docs/reference/technologie
- [Re-rendering with Context Changes](#re-rendering-with-context-changes)
- [Re-rendering with Flag Configuration Changes](#re-rendering-with-flag-configuration-changes)
- [Suspense Support](#suspense-support)
- [Tracking](#tracking)
- [Testing](#testing)
- [FAQ and troubleshooting](#faq-and-troubleshooting)
- [Resources](#resources)
Expand Down Expand Up @@ -129,7 +130,7 @@ function App() {

#### Evaluation hooks

Within the provider, you can use the various evaluation hooks to evaluate flags.
Within the provider, you can use the various evaluation hooks to evaluate flags.

```tsx
function Page() {
Expand All @@ -145,7 +146,7 @@ function Page() {
}
```

You can use the strongly-typed flag value and flag evaluation detail hooks as well, if you prefer.
You can use the strongly typed flag value and flag evaluation detail hooks as well if you prefer.

```tsx
import { useBooleanFlagValue } from '@openfeature/react-sdk';
Expand All @@ -171,7 +172,7 @@ const {
Multiple providers can be used by passing a `domain` to the `OpenFeatureProvider`:

```tsx
// Flags within this domain will use the a client/provider associated with `my-domain`,
// Flags within this domain will use the client/provider associated with `my-domain`,
function App() {
return (
<OpenFeatureProvider domain={'my-domain'}>
Expand Down Expand Up @@ -233,11 +234,11 @@ Note that if your provider doesn't support updates, this configuration has no im

#### Suspense Support

> [!NOTE]
> React suspense is an experimental feature and subject to change in future versions.
> [!NOTE]
> React suspense is an experimental feature and is 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.
It may be desirable 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.

Expand Down Expand Up @@ -270,11 +271,31 @@ function Fallback() {
// component to render before READY.
return <p>Waiting for provider to be ready...</p>;
}

```

This can be disabled in the hook options (or in the [OpenFeatureProvider](#openfeatureprovider-context-provider)).

#### Tracking

The tracking API allows you to use OpenFeature abstractions and objects to associate user actions with feature flag evaluations.
This is essential for robust experimentation powered by feature flags.
For example, a flag enhancing the appearance of a UI component might drive user engagement to a new feature; to test this hypothesis, telemetry collected by a [hook](/docs/reference/technologies/client/web/#hooks) or [provider](/docs/reference/technologies/client/web/#providers) can be associated with telemetry reported in the client's `track` function.

The React SDK includes a hook for firing tracking events in the `<OpenFeatureProvider>` context in use:

```tsx
function MyComponent() {
// get a tracking function for this <OpenFeatureProvider>.
const { track } = useTrack();

// call the tracking event
// can be done in render, useEffect, or in handlers, depending on your use case
track(eventName, trackingDetails);

return <>...</>;
}
```

### Testing

The React SDK includes a built-in context provider for testing.
Expand Down Expand Up @@ -339,23 +360,23 @@ class MyTestProvider implements Partial<Provider> {
> I get an error that says something like: `A React component suspended while rendering, but no fallback UI was specified.`

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!
This means that it will render your loading fallback automatically while your provider starts up and during context reconciliation for any of your components using feature flags!
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.
> I get odd rendering issues or errors when components mount if I use the suspense features.

In React 16/17's "Legacy Suspense", when a component suspends, its sibling components initially mount and then are hidden.
This can cause surprising effects and inconsistencies if sibling components are rendered while the provider is still getting ready.
To fix this, you can upgrade to React 18, which uses "Concurrent Suspense", in which siblings are not mounted until their suspended sibling resolves.
Alternatively, if you cannot upgrade to React 18, you can use the `useWhenProviderReady` utility hook in any sibling components to prevent them from mounting until the provider is ready.

> I am using multiple `OpenFeatureProvider` contexts, but they are sharing the same provider or evaluation context. Why?
> I am using multiple `OpenFeatureProvider` contexts, but they share the same provider or evaluation context. Why?

The `OpenFeatureProvider` binds a `client` to all child components, but the provider and context associated with that client is controlled by the `domain` parameter.
This is consistent with all OpenFeature SDKs.
To scope an OpenFeatureProvider to a particular provider/context set the `domain` parameter on your `OpenFeatureProvider`:
To scope an OpenFeatureProvider to a particular provider/context, set the `domain` parameter on your `OpenFeatureProvider`:

```tsx
<OpenFeatureProvider domain={'my-domain'}>
Expand All @@ -365,7 +386,7 @@ To scope an OpenFeatureProvider to a particular provider/context set the `domain

> I can import things form the `@openfeature/react-sdk`, `@openfeature/web-sdk`, and `@openfeature/core`; which should I use?

The `@openfeature/react-sdk` re-exports everything from its peers (`@openfeature/web-sdk` and `@openfeature/core`), and adds the React-specific features.
The `@openfeature/react-sdk` re-exports everything from its peers (`@openfeature/web-sdk` and `@openfeature/core`) and adds the React-specific features.
You can import everything from the `@openfeature/react-sdk` directly.
Avoid importing anything from `@openfeature/web-sdk` or `@openfeature/core`.

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 Thu Oct 17 2024 08:09:41 GMT+0000 (Coordinated Universal Time)
Last updated at Tue Nov 05 2024 18:07:58 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
Loading