Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deprecation guide for Array Prototype extensions #1392

Merged
merged 3 commits into from
Aug 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions content/ember/v5/deprecate-array-prototype-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ since: '5.10.0'

Ember historically extended the prototypes of native Javascript arrays to implement `Ember.Enumerable`, `Ember.MutableEnumerable`, `Ember.MutableArray`, `Ember.Array`. As of v5, the usages of array prototype extensions are deprecated.

To disable the extention of array prototypes, in `config/environment.js`, ensure that `EXTEND_PROTOYPES` is set to false on EmberENV:

```
EmberENV: {
EXTEND_PROTOTYPES: false,
....
```
IgnaceMaes marked this conversation as resolved.
Show resolved Hide resolved

Once it is set to false, audit your project for any breakage from the following methods no longer being available on native arrays. Exceptions will be thrown where they are in use:

For convenient functions like `filterBy`, `compact`, you can directly convert to use native array methods.

For mutation functions (like `pushObject`, `replace`) or observable properties (`firstObject`, `lastObject`), in order to keep the reactivity, you should take following steps:
Expand Down
Loading