-
-
Notifications
You must be signed in to change notification settings - Fork 176
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
not updating localStorage on repeateadly change #107
Comments
Can confirm. I've noticed it today as well on my form. This is actually quite critical because if the input is changed, on return it will return the old value that was stored, which sometimes can be incorrect. After some debugging, I've come across this: persist: function () {
// some binded events are redundant (change & paste for example), persist
// only once by field val
//
if (this.val === this.getVal()) { return }
this.val = this.getVal();
// if auto-expires is enabled, set the expiration date for future
// auto-deletion
//
if (this.options.expires) {
this.storage.set(this.expiresFlag, (new Date().getTime() + this.options.expires * 1000).toString())
}
this.storage.set(this.path , this.getVal());
this.options.onPersist(this.$element, this.getVal());
} Given that we have an input of type radio with Yes / No as value, the first 2 times the input is changed it returns If I remove I ran garlic.js against |
See #89. Try changing this to...
|
Hi @philwilks or @pacMakaveli, Could you please confirm this is working with the suggested above change, and if so, submit a PR accordingly? Thanks a lot |
Hi,
I tried to change repeatedly the radio from your demo ( http://garlicjs.org/#demonstration ) and printing in the console the localStorage.
I got that sometimes the value inside the localStorage is not updated and so, when I refreshed the page, I got the wrong radio to be checked.
Thanks,
Valerio
The text was updated successfully, but these errors were encountered: