Hello,
we have an array of ember objects which we render in a template with the component helper as follows:
{{each objects as |obj|}}
{{component obj.name}}
{{/each}}
Now as we replace the array with another one that contains new objects and some of the old ones - the components which had underlying old objects are never destroyed, they show in the right order instead. Ember somehow figures out that the components render the same object and doesn’t destroy them. Is that an expected behaviour?
Example:
Functions:
renderInitialObjects: ->
objects = [ Obj1, Obj2, Obj3]
@set 'objects', objects
stateChanged: ->
objects = [Obj4, Obj5, Obj1] //New Array
@set 'objects', objects
In this case on ‘stateChanged’ Ember wouldn’t render a new component with underlying Obj1, but will use the old one instead.
GitHub Issue: https://github.com/emberjs/ember.js/issues/12683