TrueCar / react-launch-darkly

Simple component helpers to support LaunchDarkly in your React app.
MIT License
76 stars 20 forks source link

ldClientWrapper as singleton #23

Closed jacobmoretti closed 7 years ago

jacobmoretti commented 7 years ago

Problem

Fixes an issue where every FeatureFlag component would re-initialize the launch darkly client. In addition, using the getAllFeatureFlags function would behave similarly. Initializing the launch darkly client is problematic as it creates redundant requests to launch darkly. That and it messes up the internal state of the object, resulting in unexpected behavior.

Solution

Refactor to using a wrapper, ldClientWrapper, and only initialize the launch darkly client once.

sethbattin commented 7 years ago

:+1:

jacobmoretti commented 7 years ago

@sethbattin Can you take a look again please

sethbattin commented 7 years ago

I think we're still good.