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
The current implementation of computed chains (field.@each.key, field.length, field.[]) is not compatible with tracked properties and native arrays when prototype extensions are not present.
This is due to the presumed existence on all arrays of the [] tag. For instance, when building the chain tags for field.@each.key the [] tag is what is entangled for the array, not length.
The result is that computed chains will not work when field is a native array without prototype extensions, nor will they work when field is a Proxy to a native array (as all EmberData arrays are).
Note that its not enough to define a '[]' getter on the native array or native array proxy that consumes a tag, as the tag will not be the same tag accessed via tagForProperty(iterable, '[]').
{{#each}}
This design issue also affects the implementation of {{#each}} which targets entanglement with [], although from experience it appears each will recalculate due to access of other tracked properties during iteration whereas computed will not because we specifically untrack computed and add back in only the specific chain tags.
Priority: high
Affects: emberjs/rfcs#848
Affects:
ember-data
4.8+Affects: all array computed macros (
filterBy
sortBy
mapBy
etc.)Related: emberjs/data#8431
Related: emberjs/data#8411
The current implementation of computed chains (
field.@each.key
,field.length
,field.[]
) is not compatible with tracked properties and native arrays when prototype extensions are not present.This is due to the presumed existence on all arrays of the
[]
tag. For instance, when building the chain tags forfield.@each.key
the[]
tag is what is entangled for the array, notlength
.ember.js/packages/@ember/-internals/metal/lib/chain-tags.ts
Lines 136 to 137 in f4e8925
The result is that computed chains will not work when
field
is a native array without prototype extensions, nor will they work whenfield
is a Proxy to a native array (as all EmberData arrays are).Note that its not enough to define a
'[]'
getter on the native array or native array proxy that consumes a tag, as the tag will not be the same tag accessed viatagForProperty(iterable, '[]')
.{{#each}}
This design issue also affects the implementation of
{{#each}}
which targets entanglement with[]
, although from experience it appears each will recalculate due to access of other tracked properties during iteration whereascomputed
will not because we specificallyuntrack
computed and add back in only the specific chain tags.ember.js/packages/@ember/-internals/glimmer/lib/helpers/-track-array.ts
Line 25 in 16136bf
The text was updated successfully, but these errors were encountered: