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
[BUG] READY -> NOT_READY race condition (@openfeature/react-sdk@0.2.3-experimental) #891
Comments
Without an exact snippet of code, I can't say for sure why you're seeing this. I have a few suggestions and a few questions. Suggestions:
Questions:
I also suggest you check out the demos here, particularly https://github.com/open-feature/react-test-app/blob/main/src/demos/SuspenseDemo.tsx. |
Hey @malinskibeniamin , don't want to bug, but any update on this? |
Hi @toddbaert, thanks for the reminder. Unfortunately at the moment I'm quite busy, hopefully I can revisit this next week. If you don't mind maybe we can keep this issue open for now |
Absolutely! No rush and no problem. I'll certainly keep this open until I hear back from you. If I find anything myself I'll follow up. |
Closing for inactivity. Please comment if you want to re-open. |
Observed behavior
Background: We use an experimental React SDK package
@openfeature/react-sdk
, as well as LaunchDarkly OpenFeature client provider from@openfeature/launchdarkly-client-provider
. At the app's root level, we initialize context withbefore rendering any feature-flagged content.
When calling
client?.providerStatus
yieldsNOT_READY
after it already transitioned toREADY
, this happens roughly once in about 10 times.We are using the following settings for the feature flag.
The component that contains the provider status call is wrapped in a Suspense, checking whether
client?.providerStatus === 'READY'
before continuing with feature flag checks.If
NOT_READY
->READY
transition occurs, it triggers a re-render for the component and the flags are properly evaluated.If
NOT_READY
->READY
->NOT_READY
transition occurs, it does not trigger a subsequent re-render.This cannot be reproduced easily through DevTools, because time delay caused by debugging prevents the race condition.
Expected Behavior
When the component has loaded, the provider should not go from
READY
toNOT_READY
state, but rather newly introducedRECONCILING
or similar if the feature flag context needs to be re-evaluated for some reason.Alternatively, ensure that going back to
NOT_READY
state (if allowed) should always re-evaluate a context, triggering a re-render.At the moment, we don't have an easy way to force the reconciliation to ensure the feature flags will not fall back to their default values.
Steps to reproduce
Previous packages:
Updated packages (error manifested after this update):
The text was updated successfully, but these errors were encountered: