Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Update setProvider to be async and remove setProviderAndWait #695

Open
beeme1mr opened this issue Nov 28, 2023 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@beeme1mr
Copy link
Member

Requirements

Overview

When setProvider was first introduced, OpenFeature didn't have support for provider initialization. It was expected that a provider was initialized prior to registering it with OpenFeature. Since then, OpenFeature has added support for initialization so that the SDK could have an awareness of the provider lifecycle and is able to emit events that developers can subscribe to. Unfortunately, this meant that a provider may not be available immediately after registration. To overcome this, developers could wait for the provider ready event to fire before performing flag evaluations. A method called setProviderAndWait was also added that returned a promise. The promise resolves when the provider is ready or is rejected if there's an error during initialization.

We've received feedback that setProviderAndWait behaves the way people expect setProvider to work. Also, setProviderAndWait is not a good name in JavaScript because it does not block a thread as the name implies. For these reasons, setProvider should be updated to behave like setProviderAndWait and setProviderAndWait should be removed. This will be a breaking change that will require a v2.0.0 of the server SDK.

Requirements

  • setProvider returns a promise that's resolved when the provider is ready or is rejected if the provider fails during initialization.
  • Remove setProviderAndWait
  • Update the documentation in the readme
@beeme1mr beeme1mr added the enhancement New feature or request label Nov 28, 2023
@toddbaert
Copy link
Member

toddbaert commented Nov 28, 2023

Worth mentioning that this is how it works in the .NET SDK as well, since this change. This is relevant because .NET features basically the same async/await semantics as TS/JS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants