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

[React]: Multiple useFeatureFlags triggers multiple /decide calls

Open weyert opened this issue 3 years ago • 0 comments

If you use the useFeatureFlags-hook throughout your webapplication and have the refresh interval enabled it triggers multiple requests to the /decide-endpoint.

Maybe its worth considering to cache the endpoint's response and allow some sort of ttl for the response? I don't think it's worth it to call this endpoint in quick succession.

For example, in my application I am using the hook in different components which triggers a bunch of /decide-endpoints:

CleanShot 2021-01-25 at 15 19 11

weyert avatar Jan 25 '21 15:01 weyert