Unleash / unleash-proxy-client-js

A browser client that can be used together with the unleash-proxy.
Apache License 2.0
44 stars 46 forks source link

fix: ready state when bootstrapping #218

Closed Tymek closed 2 weeks ago

Tymek commented 2 weeks ago

About the changes

When bootstrapping there is an edge case when:

and that made isReady() hard to implement.

Previously, the SDK wouldn’t be “ready” if it only bootstrapped, but the attempt to fetch flags failed. Now, we set the SDK to ready both when it’s bootstrapped and when you successfully fetch flags; whichever comes first. Otherwise, the existing functionality hasn’t changed. Essentially, what you’re doing here is adding a separate variable to track flag fetch status, making readyEventEmitted more accurately do what it says