Problem: There is an array e.g.
[{id: 1, name: "stefan"}, {id: 2, name: "alex"}, ...]
This list is bound to a *ngFor which can also show details.
Now there comes an update from the server with a new list
[{id: 1, name: "stefanie"}, {id: 2, name: "alexandra"}, ...]
So the ids are identical, but names are the same.
Requirement:
Now if I want to assign the new array to the existing array, *ngFor gets completly refresh, hidding my details window. However I just want to
- update the item if one with the same
idalready exists - add new items
- delete items which don't exist anymore
I found answers, how you can make this by filtering and updating, however it looks like a pretty common problem to me. So I guess there is alreay a build in function or a clever library which solves this... right?