jeromegn / Backbone.localStorage

A localStorage adapter for Backbone.js
MIT License
1.9k stars 680 forks source link

Not fetching all models from collection #159

Open dottodot opened 10 years ago

dottodot commented 10 years ago

In my Backbone Marionette app I'm adding items to the localstorage successfully but it's not returning all the models.

In my case an item is added to my cart collection and this takes you to the cart page which should list all the items in the cart. The first item added works but when a second item is added and you are taken to the cart only the latest one show.

This also only seems to happen when navigating to the cart page using a trigger, if I cmd + R refresh the page the full collection is returned.

Bit confused as to what is going on.

dottodot commented 10 years ago

OK I've found that if I set an id rather than using the guid it works as it should, sometimes i.e about 50%

nddery commented 9 years ago

Having the same problem, this seems to be random, sometimes, the full collection is returned, some other time, just a part of it. The full collection is in local storage. As dotdotdot mentionned, reloading the page the full collection is returned.

munvier commented 8 years ago

Same here, i've a collection. I add a model in it. Seems good on the View, I switch to an another view, fetch the collection, new models are missing. But if i refresh the page, my new models are here ....

EDIT : the remove works properly, but new items are missing. I must be doing wrong the add method...

yahuarkuntur commented 6 years ago

Looks like is the same as #177