You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
KeyValuePipe keeps the previous Map order when only the insertion order changes #72114
I ran into a small surprise with keyvalue: null. I reversed the entries in a Map and passed the new map to my template. A plain @for picked up the new order, but the row using the pipe stayed in the old order.
How to reproduce
Paste this into src/main.ts in an Angular CLI app, run ng serve, and click Reverse once.
I expected both rows to show c a b, since passing null tells the pipe to use the input’s natural order. If I then change the value of just one entry, the pipe catches up. KeyValuePipe docs
I also tried calling transform() directly. A fresh pipe gives me c a b for the reversed map. A pipe that already processed the original map gives me b a c for that same reversed map.
I found #71893 while looking into this. That example switches the comparator to null. Here it’s null from the first render, and only the insertion order changes.
Tested with Angular and Angular CLI 22.3.0 (@angular/common, AOT), on macOS with Chrome 157.0.8103.79.
Activity