mirror of
https://github.com/jashkenas/backbone.git
synced 2026-01-14 09:27:53 -05:00
Fixes #3882 Fixes #4159 Backbone does a bit of extra work to determine when to update `_byId` on every model change event because `change:id` will not work if `idAttribute` has changed. This causes issues as the `change` event happens after every `change:` event which means during a change the `_byId` hasn't updated. Rather than adding complexity to collection the solution is to have the model notify with the id changes. If adding a public event isn't desired, for an internal solution the model is aware of it's collection and could modify model.collection._byId directly within the set. Either of these solutions seem preferrable to handling `change:[idAttribute]` Replaces the need for: https://github.com/jashkenas/backbone/pull/4227/files#diff-c773bb9be277f0f3f2baa308b6e0f3a486790fe99fea81ddd0ba409846250571R1205