From e397e94ceff6da1e96827704f6b93183dc65f2f4 Mon Sep 17 00:00:00 2001 From: Katie Gengler Date: Thu, 22 Aug 2024 11:16:52 -0400 Subject: [PATCH 1/3] Update deprecation guide for Array Prototype extensions --- .../ember/v5/deprecate-array-prototype-extensions.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/content/ember/v5/deprecate-array-prototype-extensions.md b/content/ember/v5/deprecate-array-prototype-extensions.md index ce993aa2..e4ae6e5c 100644 --- a/content/ember/v5/deprecate-array-prototype-extensions.md +++ b/content/ember/v5/deprecate-array-prototype-extensions.md @@ -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, +.... +``` + +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: From 7ad40e35aa0022564e4e157a2186b1ef7848832f Mon Sep 17 00:00:00 2001 From: Ignace Maes Date: Thu, 22 Aug 2024 17:46:08 +0200 Subject: [PATCH 2/3] Update content/ember/v5/deprecate-array-prototype-extensions.md --- content/ember/v5/deprecate-array-prototype-extensions.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/content/ember/v5/deprecate-array-prototype-extensions.md b/content/ember/v5/deprecate-array-prototype-extensions.md index e4ae6e5c..c21190db 100644 --- a/content/ember/v5/deprecate-array-prototype-extensions.md +++ b/content/ember/v5/deprecate-array-prototype-extensions.md @@ -8,11 +8,12 @@ Ember historically extended the prototypes of native Javascript arrays to implem 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: From 21475499c3c80bbacd84f0be36a74449246986ff Mon Sep 17 00:00:00 2001 From: Ignace Maes Date: Thu, 22 Aug 2024 17:49:15 +0200 Subject: [PATCH 3/3] fix: readd triple backticks --- content/ember/v5/deprecate-array-prototype-extensions.md | 1 + 1 file changed, 1 insertion(+) diff --git a/content/ember/v5/deprecate-array-prototype-extensions.md b/content/ember/v5/deprecate-array-prototype-extensions.md index c21190db..e83770da 100644 --- a/content/ember/v5/deprecate-array-prototype-extensions.md +++ b/content/ember/v5/deprecate-array-prototype-extensions.md @@ -14,6 +14,7 @@ EmberENV: { // ... }, // ... +``` 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: