The problem is a known issue with lost concurrency updates, see Lost update in concurrency management? . For your understanding, I would suggest the following quick and dirty fix, file backbone-localstorage.js, Store.prototype.save:
save: function() {
var store = localStorage.getItem(this.name);
var data = (store && JSON.parse(store)) || {};
_.extend(this.data, data);
localStorage.setItem(this.name, JSON.stringify(this.data));
}
For the latest version of Github for LocalStorage LAN , I think it should look like this:
save: function() {
var store = this.localStorage().getItem(this.name);
var records = (store && store.split(",")) || [];
var all = _.union(records, this.records);
this.localStorage().setItem(this.name, all.join(","));
}
source
share