angular/packages/core/src/change_detection
Sirui Chen a8269264bf fix(core): make DefaultIterableDiffer keep the order of duplicates (#23941)
Previously, in `_mismatch()`, the `DefaultIterableDiffer` first checks
`_linkedRecords` for `itemTrackBy`, then checks `_unlinkedRecords`.
This cause the `DefaultIterableDiffer` to move "later" items that match the
`itemTrackBy` from the old collection, rather than using the "earlier" one.

Now we check `_unlinkedRecords` first, so that the `DefaultIterableDiffer`
can give a more stable and reasonable result after diffing. For example,
rather than (`a1` and `a2` have same trackById)

```
a1 b c a2 => b a2 c a1
```

we get

```
a1 b c a2 => b a1 c a2
```

where a1 and a2 retain their original order despite both
having the same track by value.

Fixes #23815

PR Close #23941
2021-01-26 15:44:42 -08:00
..
differs fix(core): make DefaultIterableDiffer keep the order of duplicates (#23941) 2021-01-26 15:44:42 -08:00
change_detection.ts fix(core): remove CollectionChangeRecord symbol (#38668) 2020-09-02 16:45:19 -07:00
change_detection_util.ts refactor(core): remove looseIdentical in favor of built-in Object.is (#37191) 2020-06-01 17:19:17 -04:00
change_detector_ref.ts docs: update links to use HTTPS as protocol (#39718) 2020-11-20 12:52:16 -08:00
constants.ts docs: clean up api doc in core (#37053) 2020-06-30 12:11:15 -07:00
pipe_transform.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00