PaulUithol/Backbone-relational — Issue #85: Fetching M2M collection multiple times causes duplicate add events.
Author: amccloud
Created: 2012-03-06 14:22:56+00:00
State: open

When calling fetch() on a m2m collection more than once you get some odd event behavior.

The first time you call fetch the collection only triggers reset. Every time after that the collection triggers add for each model in the collection and then reset. This is making it difficult for me to bind the collection for rendering. Shouldn't fetch only trigger add when explicitly passed {add: true}?

I tried tracking the issue to the best of my ability and it seems that silent is being removed from the options by sanitizeOptions which allows Backbone.Collection.add to trigger add. https://github.com/documentcloud/backbone/blob/master/backbone.js#L581