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

docs: Use SetProviderAndWait in README #332

Merged
merged 1 commit into from
Mar 12, 2025

Conversation

RedbackThomson
Copy link
Contributor

This PR

There is a discrepancy between the default provider registration function in the docs on openfeature.dev and in the README of this repository. Since SetProvider is async, it makes more sense to default to using SetProviderAndWait in all documentation uniformly.

  • updates the README to use SetProviderAndWait as the default registration function

Related Issues

Fixes N/A

Notes

Follow-up Tasks

How to test

@RedbackThomson RedbackThomson requested a review from a team as a code owner March 12, 2025 18:31
@RedbackThomson RedbackThomson changed the title Use SetProviderAndWait in README docs docs: Use SetProviderAndWait in README Mar 12, 2025
Signed-off-by: Nicholas Thomson <RedbackThomson@users.noreply.github.com>
Copy link

codecov bot commented Mar 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.13%. Comparing base (69d31fe) to head (5075e80).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #332   +/-   ##
=======================================
  Coverage   88.13%   88.13%           
=======================================
  Files          14       14           
  Lines        1408     1408           
=======================================
  Hits         1241     1241           
  Misses        143      143           
  Partials       24       24           
Flag Coverage Δ
e2e 88.13% <ø> (ø)
unit 88.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@beeme1mr beeme1mr left a comment

Choose a reason for hiding this comment

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

Both ways are valid but I agree that SetProviderAndWait is likely better in most example. Thanks for the PR.

@RedbackThomson
Copy link
Contributor Author

Both ways are valid but I agree that SetProviderAndWait is likely better in most example. Thanks for the PR.

My team just spent a day trying to find the flake in our unit tests, which I figured out was coming from not using the wait version. I figure people don't realise the SetProvider is async and so can cause hidden problems for people new to OpenFeature

@beeme1mr
Copy link
Member

My team just spent a day trying to find the flake in our unit tests, which I figured out was coming from not using the wait version.

Ah, sorry about that! FYI @toddbaert @lukas-reining @thomaspoignant

@beeme1mr
Copy link
Member

@RedbackThomson could you please update the basic example at the top as well?

@toddbaert
Copy link
Member

My team just spent a day trying to find the flake in our unit tests, which I figured out was coming from not using the wait version.

Ah, sorry about that! FYI @toddbaert @lukas-reining @thomaspoignant

Ya we should try to emphasize this in general as the "default" way. There's lots of cases where setting the provider asynchronously is valid (event-based frameworks such as React come to mind) but for demos and basic use cases the blocking version is much better.

@beeme1mr beeme1mr merged commit a7dbd93 into open-feature:main Mar 12, 2025
8 checks passed
@beeme1mr
Copy link
Member

Sorry @RedbackThomson, I merged too soon. Feel free to open a separate PR.

@RedbackThomson
Copy link
Contributor Author

#333

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.

3 participants