posthog-js-lite icon indicating copy to clipboard operation
posthog-js-lite copied to clipboard

fix: ensure we don't send multiple flag requests in parallel

Open frankh opened this issue 9 months ago • 2 comments

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.

frankh avatar Mar 12 '25 12:03 frankh

@PostHog/team-feature-flags should this be finished/merged/released?

marandaneto avatar Apr 23 '25 11:04 marandaneto

moving to draft until we hear from @PostHog/team-feature-flags

marandaneto avatar May 05 '25 10:05 marandaneto