Skip to content

Commit 46b9b1e

Browse files
Merge pull request #21579 from emberjs/nvp/deprecate-proxies
Implement RFC #1112: Deprecate Ember Proxies
2 parents 8c61699 + 075a719 commit 46b9b1e

26 files changed

Lines changed: 868 additions & 366 deletions

File tree

‎packages/@ember/-internals/deprecations/index.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,27 @@ export const DEPRECATIONS = {
140140
until: '8.0.0',
141141
url: 'https://deprecations.emberjs.com/id/deprecate-mixins',
142142
}),
143+
DEPRECATE_ARRAY_PROXY: deprecation({
144+
id: 'deprecate-array-proxy',
145+
for: 'ember-source',
146+
since: { available: '7.4.0' },
147+
until: '8.0.0',
148+
url: 'https://deprecations.emberjs.com/id/deprecate-array-proxy',
149+
}),
150+
DEPRECATE_OBJECT_PROXY: deprecation({
151+
id: 'deprecate-object-proxy',
152+
for: 'ember-source',
153+
since: { available: '7.4.0' },
154+
until: '8.0.0',
155+
url: 'https://deprecations.emberjs.com/id/deprecate-object-proxy',
156+
}),
157+
DEPRECATE_PROMISE_PROXY_MIXIN: deprecation({
158+
id: 'deprecate-promise-proxy-mixin',
159+
for: 'ember-source',
160+
since: { available: '7.4.0' },
161+
until: '8.0.0',
162+
url: 'https://deprecations.emberjs.com/id/deprecate-promise-proxy-mixin',
163+
}),
143164
};
144165

145166
export function deprecateUntil(message: string, deprecation: DeprecationObject) {

‎packages/@ember/-internals/glimmer/tests/integration/components/tracked-test.js‎

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@ import { computed, get, set } from '@ember/object';
77
import { Promise } from 'rsvp';
88
import { fn } from '@ember/helper';
99
import { on } from '@ember/modifier';
10-
import { moduleFor, RenderingTestCase, strip, runTask } from 'internal-test-helpers';
10+
import {
11+
moduleFor,
12+
RenderingTestCase,
13+
strip,
14+
runTask,
15+
expectDeprecation,
16+
testUnless,
17+
} from 'internal-test-helpers';
18+
import { DEPRECATIONS } from '@ember/-internals/deprecations';
1119
import GlimmerishComponent from '../../utils/glimmerish-component';
1220
import Component from '@glimmer/component';
1321
import { Component as EmberComponent } from '../../utils/helpers';
@@ -96,7 +104,15 @@ moduleFor(
96104
this.assertText('max jackson | max jackson');
97105
}
98106

99-
'@test creating an array proxy inside a tracking context does not trigger backtracking assertion'() {
107+
[`${testUnless(
108+
DEPRECATIONS.DEPRECATE_ARRAY_PROXY.isRemoved
109+
)} @test creating an array proxy inside a tracking context does not trigger backtracking assertion`]() {
110+
expectDeprecation(/`ArrayProxy` is deprecated/, DEPRECATIONS.DEPRECATE_ARRAY_PROXY.isEnabled);
111+
expectDeprecation(
112+
/`PromiseProxyMixin` is deprecated/,
113+
DEPRECATIONS.DEPRECATE_PROMISE_PROXY_MIXIN.isEnabled
114+
);
115+
100116
let PromiseArray = ArrayProxy.extend(PromiseProxyMixin);
101117

102118
class LoaderComponent extends GlimmerishComponent {
@@ -124,7 +140,11 @@ moduleFor(
124140
this.assertText('123');
125141
}
126142

127-
'@test creating an array proxy inside a tracking context and immediately updating its content before usage does not trigger backtracking assertion'() {
143+
[`${testUnless(
144+
DEPRECATIONS.DEPRECATE_ARRAY_PROXY.isRemoved
145+
)} @test creating an array proxy inside a tracking context and immediately updating its content before usage does not trigger backtracking assertion`]() {
146+
expectDeprecation(/`ArrayProxy` is deprecated/, DEPRECATIONS.DEPRECATE_ARRAY_PROXY.isEnabled);
147+
128148
class LoaderComponent extends GlimmerishComponent {
129149
get data() {
130150
if (!this._data) {

‎packages/@ember/-internals/glimmer/tests/integration/content-test.js‎

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
import { DEBUG } from '@glimmer/env';
22

3-
import { RenderingTestCase, moduleFor, applyMixins, classes, runTask } from 'internal-test-helpers';
3+
import {
4+
RenderingTestCase,
5+
moduleFor,
6+
applyMixins,
7+
classes,
8+
runTask,
9+
expectDeprecation,
10+
testUnless,
11+
} from 'internal-test-helpers';
12+
import { DEPRECATIONS } from '@ember/-internals/deprecations';
413

514
import { set, computed } from '@ember/object';
615
import { getDebugFunction, setDebugFunction } from '@ember/debug';
@@ -346,7 +355,11 @@ class DynamicContentTest extends RenderingTestCase {
346355
this.assertInvariants();
347356
}
348357

349-
['@test it can read from a proxy object']() {
358+
[`${testUnless(
359+
DEPRECATIONS.DEPRECATE_OBJECT_PROXY.isRemoved
360+
)} @test it can read from a proxy object`]() {
361+
expectDeprecation(/`ObjectProxy` is deprecated/, DEPRECATIONS.DEPRECATE_OBJECT_PROXY.isEnabled);
362+
350363
this.renderPath('this.proxy.name', {
351364
proxy: ObjectProxy.create({ content: { name: 'Tom Dale' } }),
352365
});
@@ -382,7 +395,11 @@ class DynamicContentTest extends RenderingTestCase {
382395
this.assertInvariants();
383396
}
384397

385-
['@test it can read from a nested path in a proxy object']() {
398+
[`${testUnless(
399+
DEPRECATIONS.DEPRECATE_OBJECT_PROXY.isRemoved
400+
)} @test it can read from a nested path in a proxy object`]() {
401+
expectDeprecation(/`ObjectProxy` is deprecated/, DEPRECATIONS.DEPRECATE_OBJECT_PROXY.isEnabled);
402+
386403
this.renderPath('this.proxy.name.last', {
387404
proxy: ObjectProxy.create({
388405
content: { name: { first: 'Tom', last: 'Dale' } },
@@ -439,7 +456,11 @@ class DynamicContentTest extends RenderingTestCase {
439456
this.assertInvariants();
440457
}
441458

442-
['@test it can read from a path flipping between a proxy and a real object']() {
459+
[`${testUnless(
460+
DEPRECATIONS.DEPRECATE_OBJECT_PROXY.isRemoved
461+
)} @test it can read from a path flipping between a proxy and a real object`]() {
462+
expectDeprecation(/`ObjectProxy` is deprecated/, DEPRECATIONS.DEPRECATE_OBJECT_PROXY.isEnabled);
463+
443464
this.renderPath('this.proxyOrObject.name.last', {
444465
proxyOrObject: ObjectProxy.create({
445466
content: { name: { first: 'Tom', last: 'Dale' } },
@@ -517,7 +538,11 @@ class DynamicContentTest extends RenderingTestCase {
517538
this.assertInvariants();
518539
}
519540

520-
['@test it can read from a path flipping between a real object and a proxy']() {
541+
[`${testUnless(
542+
DEPRECATIONS.DEPRECATE_OBJECT_PROXY.isRemoved
543+
)} @test it can read from a path flipping between a real object and a proxy`]() {
544+
expectDeprecation(/`ObjectProxy` is deprecated/, DEPRECATIONS.DEPRECATE_OBJECT_PROXY.isEnabled);
545+
521546
this.renderPath('this.objectOrProxy.name.last', {
522547
objectOrProxy: { name: { first: 'Tom', last: 'Dale' } },
523548
});

0 commit comments

Comments
 (0)