Transformations versus mutations
Transformation methods and mutative methods can be a source of confusion when it comes to change detection. Transformation methods are used to provide a side-effect with the data that it needs to detect changes. Mutative methods produce a new collection as a new version of the old collection.
Transformations always return new collections
Mutative methods will return the same collection reference if nothing actually changes. This is what enables strict equality change detection. Transformation methods, on the other hand, don't have this capability. This means that if a transformation method results in the exact same collection values, it still returns a new reference. Let's look at the difference between mutated collections and transformed collections:
const myList = List.of( Map.of('one', 1, 'two', 2), Map.of('three', 3, 'four', 4), Map.of('five', 5, 'six', 6) ); const myTransformedList = myList.map(v => v); const myMutatedList = myList .update(0...