Feature: return a promise from reloadFeatureFlags
Hi there!
I'm running into the following problem: When a user signs in, I identify them, and feature flags might change. I didn't find a way to wait for the new feature flags to load. They are already loaded based on the non-identified user, so hasLoadedFlags will already be permanently true, so ensureFlagsLoaded and onFeatureFlags won't help either.
My current suggestion would be to return a Promise from reloadFeatureFlags. This way, I could await that promise right after I call identify.
I believe we were able to do this with a callback previously, but it looks like this was removed in the more recent versions of posthog-react-native?
@dbartholomae which SDK are you using and which version?
This is in a web app, using posthog-js 1.279.0
cc @PostHog/team-feature-flags
Hello, I have encountered this issue:
- Call
setPersonProperties(props) - Call
reloadFeatureFlags() - Wait for the
onFeatureFlagscallback to fire - Immediately call
posthog.getFeatureFlag(flagName)=> it returns an incorrect value based on the release condition - Calling
posthog.getFeatureFlag(flagName)again after some time → it returns the correct value
It seems that the first read after onFeatureFlags does not reflect the updated flag state.