Skip to content

Commit

Permalink
Merge pull request #1392 from ember-learn/kategengler-patch-1
Browse files Browse the repository at this point in the history
Update deprecation guide for Array Prototype extensions
  • Loading branch information
IgnaceMaes authored Aug 22, 2024
2 parents 8917059 + 2147549 commit 4ffb570
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 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,18 @@ 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:

```js
EmberENV: {
EXTEND_PROTOTYPES: false,
// ...
},
// ...
```

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

0 comments on commit 4ffb570

Please sign in to comment.