Skip to content

Commit c009ddc

Browse files
fix: address PR review comments for WebMultiProvider naming and documentation
Signed-off-by: Jonathan Norris <[email protected]>
1 parent 8a90662 commit c009ddc

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

packages/web/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ The Multi-Provider is a powerful tool for performing migrations between flag pro
155155
- **Multiple Data Sources**: The Multi-Provider allows you to seamlessly combine many sources of flagging data, such as environment variables, local files, database values and SaaS hosted feature management systems.
156156

157157
```ts
158-
import { MultiProvider } from '@openfeature/web-sdk';
158+
import { WebMultiProvider } from '@openfeature/web-sdk';
159159

160-
const multiProvider = new MultiProvider([
160+
const multiProvider = new WebMultiProvider([
161161
{ provider: new ProviderA() },
162162
{ provider: new ProviderB() }
163163
]);
@@ -176,12 +176,12 @@ The Multi-Provider comes with three strategies out of the box:
176176

177177
- **FirstMatchStrategy** (default): Evaluates all providers in order and returns the first successful result. Providers that indicate FLAG_NOT_FOUND error will be skipped and the next provider will be evaluated.
178178
- **FirstSuccessfulStrategy**: Evaluates all providers in order and returns the first successful result. Any error will cause that provider to be skipped.
179-
- **ComparisonStrategy**: Evaluates all providers in parallel. If every provider returns a successful result with the same value, then that result is returned. Otherwise, the result returned by the configured "fallback provider" will be used.
179+
- **ComparisonStrategy**: Evaluates all providers sequentially. If every provider returns a successful result with the same value, then that result is returned. Otherwise, the result returned by the configured "fallback provider" will be used.
180180

181181
```ts
182-
import { MultiProvider, FirstSuccessfulStrategy } from '@openfeature/web-sdk';
182+
import { WebMultiProvider, FirstSuccessfulStrategy } from '@openfeature/web-sdk';
183183

184-
const multiProvider = new MultiProvider(
184+
const multiProvider = new WebMultiProvider(
185185
[
186186
{ provider: new ProviderA() },
187187
{ provider: new ProviderB() }

packages/web/src/provider/multi-provider/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ const multiProvider = new WebMultiProvider(
5656

5757
The Multi-Provider comes with three strategies out of the box:
5858

59-
- `FirstMatchStrategy` (default): Evaluates all providers in order and returns the first successful result. Providers that indicate FLAG_NOT_FOUND error will be skipped and the next provider will be evaluated. Any other error will cause the operation to fail and the set of errors to be thrown.
59+
- `FirstMatchStrategy` (default): Evaluates all providers in order and returns the first successful result. Providers that indicate FLAG_NOT_FOUND error will be skipped and the next provider will be evaluated. Any other error will cause the operation to fail and the set of errors to be thrown.
6060
- `FirstSuccessfulStrategy`: Evaluates all providers in order and returns the first successful result. Any error will cause that provider to be skipped.
6161
If no successful result is returned, the set of errors will be thrown.
62-
- `ComparisonStrategy`: Evaluates all providers in parallel. If every provider returns a successful result with the same value, then that result is returned.
62+
- `ComparisonStrategy`: Evaluates all providers sequentially. If every provider returns a successful result with the same value, then that result is returned.
6363
Otherwise, the result returned by the configured "fallback provider" will be used. When values do not agree, an optional callback will be executed to notify
6464
you of the mismatch. This can be useful when migrating between providers that are expected to contain identical configuration. You can easily spot mismatches
6565
in configuration without affecting flag behaviour.

packages/web/src/provider/multi-provider/status-tracker.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ export class StatusTracker {
5555
this.providerStatuses[name] = status;
5656
const newStatus = this.getStatusFromProviderStatuses();
5757
if (currentStatus !== newStatus) {
58-
if (newStatus === ProviderStatus.FATAL) {
59-
this.events.emit(ProviderEvents.Error, details);
60-
} else if (newStatus === ProviderStatus.ERROR) {
58+
if (newStatus === ProviderStatus.FATAL || newStatus === ProviderStatus.ERROR) {
6159
this.events.emit(ProviderEvents.Error, details);
6260
} else if (newStatus === ProviderStatus.STALE) {
6361
this.events.emit(ProviderEvents.Stale, details);

0 commit comments

Comments
 (0)