posthog-js-lite
posthog-js-lite copied to clipboard
fix: ensure we don't send multiple flag requests in parallel
Problem
currently if we call e.g. getFeatureFlags() 100 times straight away after initialisation we will send 100 fetch requests before the first one returns
this is even worse if e.g. we are erroring so never setting loadedSuccessfullyOnce
Changes
add logic to check if we have an inflight request already and block on the existing one instead of starting a new one
Release info Sub-libraries affected
Bump level
- [ ] Major
- [ ] Minor
- [x] Patch
Libraries affected
- [ ] All of them
- [ ] posthog-web
- [x] posthog-node
- [ ] posthog-ai
- [ ] posthog-react-native
Changelog notes
- Fix: don't send multiple feature flag fetch requests in parallel.
@PostHog/team-feature-flags should this be finished/merged/released?
moving to draft until we hear from @PostHog/team-feature-flags