-
Notifications
You must be signed in to change notification settings - Fork 67
Request of feature flag immediately after ldClient.on('ready') returns undefined #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @miymiy , Yes, when the Could you share your initialization code? Also, do you see any errors in the browser console? |
Hey @apucacao , Thanks for responding! Here are the code snippets (think majority of it is a copy from ldRedux). There were no errors in console. On init
setLDReady sets the state.LD.isLDReady flag to true. And then the wrapper component
|
add unit test for customer-contributed fix to localstorage logic
Hi - sorry we did not check in again on this issue earlier. Your code sample looked good as far as we could tell, so it wasn't clear what was going on. I do see however that ld-redux seems to have changed significantly since then, so I'm wondering whether you are using the new version and if so, have you still seen any similar problems? |
We have a wrapper feature toggle component wraps around ldClient. It is basically a copy of ld-redux code with some minor changes. Upon initialisation, the following event occurs
window.ldClient.on('ready', () => { reduxStore.dispatch(setLDReady()); });
This action triggers the feature toggle component update
in the function initialise feature flag query is fired
ldClient.variation(flagNameInLd, ldDefaultValues[flagNameInLd])
And it always returns undefined - checking dev console in Launch Darkly it also shows undefined as a value.
The above code works if I put a setTimeout wrapper around
reduxStore.dispatch(setLDReady());
and force a 100ms delay.My question is, when ldClient emits the ready event, is it really ready for features to be queried? or should we be using other events?
The text was updated successfully, but these errors were encountered: