jashkenas / backbone

Give your JS App some Backbone with Models, Views, Collections, and Events
http://backbonejs.org
MIT License
28.09k stars 5.38k forks source link

Remove model from collection when model ID is unset #4227

Closed rgroothuijsen closed 2 years ago

rgroothuijsen commented 4 years ago

This PR fixes issue #4159, where a model was not properly removed from a collection after its ID was unset. The cause for this is that _onModelEvent handles potential model deletions upon detecting an event called "change", when the actual event name being sent was "change:(attribute)". An extra check was added so that the latter case is handled as well.

ogonkov commented 2 years ago

This is a breaking change, and logic 'no id = no place in collection' is seems broken to me generally.

jgonggrijp commented 2 years ago

Obsolete because of #4249.