Skip to content

feat!: Update setProvider to be async and remove setProviderAndWait #695#1344

Open
ScottVenkataraman wants to merge 4 commits intoopen-feature:mainfrom
ScottVenkataraman:feat/update_setProvider_to_be_async
Open

feat!: Update setProvider to be async and remove setProviderAndWait #695#1344
ScottVenkataraman wants to merge 4 commits intoopen-feature:mainfrom
ScottVenkataraman:feat/update_setProvider_to_be_async

Conversation

@ScottVenkataraman
Copy link

This PR

Related Issues

Fixes #695

Notes

This is my first PR for Open Feature, please let me know if I missed something in the contributing process or need to make any changes.

…ready or is rejected if the provider fails during initialization.

Remove `setProviderAndWait`
Update the documentation in the readme

Signed-off-by: Scott Venkataraman <scottvenkataraman22@gmail.com>
@ScottVenkataraman ScottVenkataraman requested review from a team as code owners February 16, 2026 19:31
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ScottVenkataraman, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the core setProvider API across the OpenFeature SDKs to embrace asynchronous behavior. By making setProvider return a Promise, the need for a separate setProviderAndWait method is eliminated, simplifying the developer experience and ensuring that provider initialization is always handled in an awaitable manner. This change promotes a more consistent and robust approach to managing provider lifecycles, with all related documentation and test cases updated to reflect the new standard.

Highlights

  • API Simplification: The setProvider method has been updated to be asynchronous, returning a Promise that resolves when the provider is ready or rejects if initialization fails. This change streamlines the API by making setProvider consistently awaitable.
  • Removal of Redundant Method: The setProviderAndWait method has been removed, as its functionality is now integrated directly into the setProvider method.
  • Documentation Updates: All relevant documentation, including READMEs and code comments across server, web, and Angular SDKs, has been updated to reflect the new asynchronous behavior of setProvider and the removal of setProviderAndWait.
  • Dependency Updates: The package-lock.json file has been updated to include peer: true for several optional dependencies and to align Angular SDK versions.
Changelog
  • package-lock.json
    • Added 'peer: true' to various optional dependencies.
    • Updated '@angular/compiler-cli' version from '^21.1.0' to '^21.0.4'.
    • Updated '@openfeature/angular-sdk' version from '0.0.20' to '1.0.0'.
  • packages/angular/projects/angular-sdk/src/lib/feature-flag.directive.spec.ts
    • Replaced OpenFeature.setProviderAndWait with OpenFeature.setProvider in test cases.
  • packages/angular/projects/angular-sdk/src/lib/open-feature.module.ts
    • Removed references to setProviderAndWait from JSDoc comments.
  • packages/react/test/evaluation.spec.tsx
    • Replaced OpenFeature.setProviderAndWait with OpenFeature.setProvider in multiple evaluation test cases.
  • packages/react/test/tracking.spec.tsx
    • Replaced OpenFeature.setProviderAndWait with OpenFeature.setProvider in tracking test cases.
  • packages/server/README.md
    • Updated code examples to use await OpenFeature.setProvider for provider registration.
    • Removed documentation section for synchronous setProvider and setProviderAndWait.
  • packages/server/src/open-feature.ts
    • Removed the setProviderAndWait method signature and implementation.
    • Modified the setProvider method signature to return Promise<void> instead of this.
  • packages/server/src/provider/multi-provider/README.md
    • Updated code examples to use await OpenFeature.setProvider.
  • packages/server/test/events.spec.ts
    • Replaced OpenFeature.setProviderAndWait with OpenFeature.setProvider in event handling tests.
  • packages/server/test/hooks-data.spec.ts
    • Replaced OpenFeature.setProviderAndWait with OpenFeature.setProvider in hook data tests.
  • packages/server/test/open-feature.spec.ts
    • Replaced OpenFeature.setProviderAndWait with OpenFeature.setProvider in provider lifecycle tests.
  • packages/shared/src/open-feature.ts
    • Removed the abstract setProviderAndWait method declaration.
    • Modified the abstract setProvider method declaration to return Promise<void>.
  • packages/web/README.md
    • Updated code examples to use await OpenFeature.setProvider for provider registration.
    • Removed references to setProviderAndWait in the documentation.
  • packages/web/src/open-feature.ts
    • Removed the setProviderAndWait method signature and implementation.
    • Modified the setProvider method signature to return Promise<void> instead of this.
  • packages/web/src/provider/multi-provider/README.md
    • Updated code examples to use await OpenFeature.setProvider.
  • packages/web/test/client.spec.ts
    • Replaced OpenFeature.setProviderAndWait with OpenFeature.setProvider in client initialization tests.
  • packages/web/test/evaluation-context.spec.ts
    • Replaced OpenFeature.setProviderAndWait with OpenFeature.setProvider in evaluation context tests.
  • packages/web/test/events.spec.ts
    • Replaced OpenFeature.setProviderAndWait with OpenFeature.setProvider in event handling tests.
  • packages/web/test/open-feature.spec.ts
    • Replaced OpenFeature.setProviderAndWait with OpenFeature.setProvider in provider lifecycle tests.
Activity
  • The author, ScottVenkataraman, has indicated this is their first pull request for Open Feature and is open to feedback on the contributing process or any necessary changes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a great step towards simplifying the API by making setProvider asynchronous and removing the setProviderAndWait method. The changes are applied consistently across the codebase, including tests and documentation. I've identified a critical issue in the Angular module where the new asynchronous nature of setProvider isn't correctly handled, potentially leading to unhandled promise rejections. Additionally, there's a minor documentation clarification I've suggested for better readability. Overall, this is a valuable contribution.

-Grammatical edit to packages/web/README.md
-Add catch to async call in angular module, as well as replace .map with .forEach.

Signed-off-by: Scott Venkataraman <scottvenkataraman22@gmail.com>
@ScottVenkataraman ScottVenkataraman changed the title [FEATURE] Update setProvider to be async and remove setProviderAndWait #695 feat: Update setProvider to be async and remove setProviderAndWait #695 Feb 16, 2026
Copy link
Member

@lukas-reining lukas-reining left a comment

Choose a reason for hiding this comment

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

Thank you for the change @ScottVenkataraman!
We can not merge this immediately due to the other changes discussed for the 2.0 release. #799
Once we get to this point, we will happily include this!

@open-feature/sdk-javascript-maintainers @open-feature/sdk-javascript-maintainers

@beeme1mr beeme1mr changed the title feat: Update setProvider to be async and remove setProviderAndWait #695 feat!: Update setProvider to be async and remove setProviderAndWait #695 Feb 23, 2026
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] Update setProvider to be async and remove setProviderAndWait

2 participants