Skip to content
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

Have to refresh twice to get latest flag value if LocalStorage is enabled. #59

Closed
abhijeetahuja opened this issue Dec 16, 2017 · 1 comment
Assignees

Comments

@abhijeetahuja
Copy link

If local storage is enabled, launch darkly still servers the old value from local storage and updates it after the remote call is finished, hence user gets the old flag on first refresh, and is only able to get actual updated value after second refresh. And you can't ask user to refresh twice.

@atrakh atrakh self-assigned this Jan 8, 2018
@atrakh
Copy link
Contributor

atrakh commented Jan 8, 2018

Hi @abhijeetahuja,

Thanks for reaching out, and apologies for the delay in getting a response out on this issue. It sounds like you're bootstrapping the JavaScript SDK from localStorage, but would like to automatically update a user's flag settings, without refreshing the page. Is that right?

If so, I'd recommend subscribing to feature flag changes, and re-rendering your UI to reflect update feature flags whenever a change event does come through. Subscribing to flag changes to re-render your UI may look something like this:

ldclient.on('change:myFeature', function(value, previous) {
  // logic to re-render myFeature with the new feature flag value
});

Does that sound like the behavior you were looking for? Given the age of this issue, I'll be closing it for now, but please don't hesitate to reply if you have any more questions 😄

@atrakh atrakh closed this as completed Jan 8, 2018
eli-darkly added a commit that referenced this issue May 8, 2018
revert the rest of the custom header changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants