Skip to content

feat: set context during provider registration#749

Closed
beeme1mr wants to merge 1 commit intomainfrom
context-at-set-provider
Closed

feat: set context during provider registration#749
beeme1mr wants to merge 1 commit intomainfrom
context-at-set-provider

Conversation

@beeme1mr
Copy link
Copy Markdown
Member

@beeme1mr beeme1mr commented Jan 9, 2024

This PR

  • overloads the set provider methods to support defining context
  • updates to the server and client readmes

Related Issues

Fixes #748

Notes

I had to move the logic outside of the abstract class because the client supports named client context, which isn't available in the abstract. I also have to define the overloads on each implementation (web, server) in order for intellisense to work properly.

Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
@beeme1mr beeme1mr requested a review from a team as a code owner January 9, 2024 14:21
await OpenFeature.setProviderAndWait(provider);
expect(provider.status).toBe(ProviderStatus.READY);
expect(spy).toBeCalled();
expect(spy).toHaveBeenCalled();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toBeCalled has been deprecated.

@beeme1mr
Copy link
Copy Markdown
Member Author

Marking this as a draft until the spec is approved.

open-feature/spec#229

@beeme1mr beeme1mr marked this pull request as draft January 10, 2024 18:23
Comment thread packages/client/README.md
Comment thread packages/client/README.md
This can be overridden by explicitly setting context during initialization or by references the name used during provider registration.

```ts
OpenFeature.setProvider("clientForCache", new NewCachedProvider(), { isCache: true});
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setProviderAndWait

@beeme1mr
Copy link
Copy Markdown
Member Author

Closing in favor of #919

@beeme1mr beeme1mr closed this Apr 25, 2024
@beeme1mr beeme1mr deleted the context-at-set-provider branch February 5, 2025 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Support setting global evaluation context when registering a provider

1 participant