Inconsistent documentation/implementation of "forEachIdentityChange" in change_detection/differs.
See original GitHub issue📚 Docs or angular.io bug report
Description
Inconsistent documentation of forEachIdentityChange in IterableChanges vs implementation in DefaultIterableDiffer.
Documentation states:
Iterate over all items which had their identity (as computed by the `TrackByFunction`) changed.
Implementation compares identity of the items, not the return of trackByFunction:
if (!looseIdentical(record.item, item)) this._addIdentityChange(record, item);
🔬 Minimal Reproduction
What’s the affected URL?**
git repo: angular/packages/core/src/change_detection/differs/
Reproduction Steps**
Not applicable.
Expected vs Actual Behavior**
Either documentation or implementation should be changed to be consistent.
📷Screenshot
Not applicable.
🔥 Exception or Error
Not applicable.
🌍 Your Environment
Angular 9.1.x - 10.x.x (but I think this exists since 4.0.0)
Browser info
Not applicable.
Anything else relevant?
Nope.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think naming it
forEachItemChange
would be better.Because at first I recognised this as “the items that identity changed (and the identity is computed by trackBy)”, but when an identity indeed changed it was actually performed by an addition and a removal. I don’t think the current one make sense.
What does ‘identity’ mean here?
I have following codes: