Skip to content

pushObjects() doesn't work when the argument is an ArrayProxy #9843

@bendemboski

Description

@bendemboski

Using Ember 1.8.1 on Chrome 39.0.2171.71, execute the following command in the browser console:

[].pushObjects(Ember.ArrayProxy.create({ content: [ 1, 2, 3 ] }))

Since an ArrayProxy is an enumerable, the return value should be [ 1, 2, 3 ], but instead it is an array containing a single object, which is the ArrayProxy. You can verify this by running:

[].pushObjects(Ember.ArrayProxy.create({ content: [ 1, 2, 3 ] }))[0].constructor

and seeing that the result is Ember.ArrayProxy.

I believe the bug is caused by https://github.com/emberjs/ember.js/blob/v1.8.1/packages/ember-metal/lib/enumerable_utils.js#L134. objects is the array proxy, and [].concat() is a native method that doesn't understand ArrayProxies, and just sees it as a single object to be pushed onto the array.

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