You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
0.9.1 just threw a "Can't add the same model to a collection twice" error. This helped me identify and resolve a serious server-side bug that might have gone unnoticed for some time if the client-side error had not been thrown.
I see that duplicates are ignored silently as of 0.9.2 and this was clearly a conscious decision so I just wondered what the motivation for this was.
I can't think of a reason (other than a bug) for trying to add a duplicate model to a collection that can't support duplicates and I would therefore expect to see an error message even if the code is able to mitigate the error as 0.9.2 does.
The text was updated successfully, but these errors were encountered:
For a long time -- our position and reasoning was along the same lines as yours: Duplicate models in a collection indicate an application logic error, and should be warned early.
But there are a number of folks who appreciate "sloppy" adds, where you can just keep trying to add models to a collection without checking if they're in there first -- so we made the change to be more forgiving.
Feel free to override your copy of Backbone.Collection.prototype.add with an early check and error if you like.
0.9.1 just threw a "Can't add the same model to a collection twice" error. This helped me identify and resolve a serious server-side bug that might have gone unnoticed for some time if the client-side error had not been thrown.
I see that duplicates are ignored silently as of 0.9.2 and this was clearly a conscious decision so I just wondered what the motivation for this was.
I can't think of a reason (other than a bug) for trying to add a duplicate model to a collection that can't support duplicates and I would therefore expect to see an error message even if the code is able to mitigate the error as 0.9.2 does.
The text was updated successfully, but these errors were encountered: