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.
Problem
Fixes an issue where every
FeatureFlag
component would re-initialize the launch darkly client. In addition, using thegetAllFeatureFlags
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.