-
Notifications
You must be signed in to change notification settings - Fork 674
Description
I've read in other comments to another issue that this library wasn't necessary intended to work with single models which might be why I am seeing this issue.
I have a model with a static / constant id, 'settings'.
Each time I make a change to the attributes of my settings object I do a model.save. Each save appends a new 'settings' value to the current local storage value.
example:
first save creates two local storage entries:
settings -> settings
settings-settings -> json object
next save:
settings -> settings,settings
settings-settings -> json object
next save:
settings -> settings,settings,settings
settings-settings -> json object
etc.
I've changed the save method to look at the value before setting which seemed to work but not sure if this will break something else:
save: function() {
var records = this.records.join(',');
var value = this.localStorage().getItem(this.name);
if(!value || records.indexOf(value) === -1) {
this.localStorage().setItem(this.name, records);
}
},