coresmart / persistencejs

persistence.js is an asynchronous Javascript database mapper library. You can use it in the browser, as well on the server (and you can share data models between them).
http://persistencejs.org
1.72k stars 239 forks source link

Possible bug in Persistence.Sync - Local changes not correctly sent to server #140

Open nova706 opened 10 years ago

nova706 commented 10 years ago

Line 141 of persistence.sync will not do anything because the original arrays are not altered by the concat method.

existingItems.concat(groupOfExistingItems);

should be:

existingItems = existingItems.concat(groupOfExistingItems);

From MDN: "concat does not alter this or any of the arrays provided as arguments but instead returns a shallow copy that contains copies of the same elements combined from the original arrays." https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat

BredStik commented 10 years ago

+1