Skip to content

@computed chains not compatible with native arrays #20386

Description

@runspired

Priority: high
Affects: emberjs/rfcs#848
Affects: ember-data 4.8+
Affects: all array computed macros (filterBy sortBy mapBy etc.)
Related: warp-drive-data/warp-drive#8431
Related: warp-drive-data/warp-drive#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 for field.@each.key the [] tag is what is entangled for the array, not length.

// Push the tag for the array length itself
chainTags.push(tagForProperty(current, '[]', true, currentTagMeta));

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.

consumeTag(tagForProperty(iterable, '[]'));

Activity

  1. kategengler commented on Jun 22, 2026

    @kategengler
    Member

    We are unlikely to touch computed chains or array computed macros since we plan to deprecate them emberjs/rfcs#1129

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions