This is a side effect of how {{#each}} (and CollectionView , which is its power).
Inside CollectionView , something called array watchers is used. An array observer allows you to subscribe to mutations made for an array when they are performed using the Ember.Array mutation Ember.Array ( replace , pushObject , popObject , etc.) The API for array observers is described here .
This means that if you insert a new object into the collection view, it will insert one new element into the DOM and leave the rest in place.
In the above example, the array does not mutate - you create a new Array object each time a new element is added or deleted. When the binding is synchronized, it replaces the old array with the new array. For {{#each}} this is no different than deleting all elements and then adding them back.
The solution to this problem is to use a single array instead of a computed property that returns each object of the array each time it changes. You can see the Contacts app for an example of how to do this .
Obviously, this is a very common template, and we would like to add some kind of filtering, which by default does Ember.ArrayController by default.
Tom dale
source share