Skip to content

id duplication nightmare #395

josx opened this Issue Aug 19, 2013 · 2 comments

3 participants

josx commented Aug 19, 2013

Hi all!
I am searching on server with backbone collection (with related models), so every time someone search I do a:


The problem is that i cant search twice something beacuse I am getting a duplicte Id. It is already on store but it is the same object, is there a way to avoid that.

Maybe If the object on collection is the same on the store dont throw duplicate id exception.

I know that already exist findOrCreate() but i cant use it (on collections).
I think Relational needs to have something at collection level doing the same thing.


Generally a collection.fetch() won't throw that error because it will automatically reuse any model instances that exist with the same ID.

I experienced some edge cases (described in #342) where a race condition can cause this error if you're POSTing a new model and fetching the collection right around the same time. Is that what you're doing?

josx commented Aug 19, 2013

I am using that sync models/collections over instead of using ajax.

It might be something with that I need to research more.

@bpatram bpatram added the bug label Mar 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.