Repository navigation
Deprecate A(), the array computed macros, and Ember array use on query param arrays (RFC 1114) - #21687
Conversation
There was a problem hiding this comment.
most of the PR diff is this file -- which... oof
|
I'm not confident that this actually would make it possible for us to remove the implementation after the deprecation period. How do we know none of the internal usages are actually providing user-visible behaviors? If they are, then people using those features are still dependent on EmberA and we won't be able to remove it. Possibly user-visible internal usages:
Also, I don't think any of our tests should use |
0d66867 to
1dc6e5c
Compare
1dc6e5c to
7bb1b14
Compare
3ba8803 to
44e5959
Compare
…y param arrays (RFC 1114) RFC 1114 deprecates Ember Array. The mixins (EmberArray, MutableArray, NativeArray, Enumerable) and ArrayProxy already have deprecations. This adds the parts that had none. - `A` from `@ember/array` reports `deprecate-ember-array-a`. - The 14 array macros from `@ember/object/computed` report `deprecate-array-computed-macros`. Each macro reports its own name. `mapBy`, `filterBy` and `union` no longer call another public macro, so one use gives one deprecation. - Query param arrays (the copy of a default value, and a value from the URL) are Ember arrays that report `deprecate-query-param-ember-array` when application code uses an Ember array member, for example `pushObject` or `firstObject`. One call from application code gives one report. All three are available in 7.5.0, are not enabled, and go away in 8.0.0. Each path that gives application code an Ember array now reports, or gives a native array. The data adapter hooks return native arrays, and `releaseMethods` is a native array. Tests about Ember arrays use the public `A`, expect its deprecation, and do not run when it is removed. Shared fixtures of the Ember array suites silence the deprecation, the same way as the `ArrayProxy` fixtures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7bb1b14 to
d9562ed
Compare

A(), the array computed macros, and Ember array use on query param arrays now have deprecations. These were the parts of RFC 1114 that had none.How to review
Hide whitespace in the diff. One test file is in a new
ifblock, so most of its lines change only in indentation.This PR is on top of #21588, and its base branch is
nvp/deprecate-mixin-followups. Merge #21588 first.The tests that are not about Ember arrays moved off
A()in #21690, which is merged. This PR holds only the deprecations and the tests about Ember arrays.RFC:
Advancement:
"Deprecating Ember Array"to Stage Ready for Release rfcs#1140Guides:
What RFC 1114 lists, and where each part is
Changes
The three deprecations are available in 7.5.0, are not enabled, and go away in 8.0.0.
deprecate-ember-array-a:Afrom@ember/arrayreports on each call.deprecate-array-computed-macros:collect,filter,filterBy,intersect,map,mapBy,max,min,setDiff,sort,sum,union,uniqanduniqByfrom@ember/object/computedreport when you call them. The message names the macro.deprecate-query-param-ember-array: the array value of a query param reports when application code uses an Ember array member on it, for examplepushObjectorfirstObject.Each macro reports one time for each use.
mapBy,filterByandunioncalledmap,filteranduniqbefore, so they now share private functions with them.The messages point to native JavaScript and to
trackedArrayfrom@ember/reactive/collections.Where application code can get an Ember array
The implementation can go away in 8.0 only if each of these paths reports before that.
Query param arrays
A controller gets an Ember array for a query param with an array default.
pushObjecton that array updates the URL, andArray query params can be pushed/poppedtests this. So the value stays an Ember array until 8.0, and each Ember array member on it reports when application code uses it. One call from application code gives one report.Ember does not use these members on a query param array. The full suite with all deprecations on gives a report only in that one test.
The migration is to assign a new array to the property.
Array query params can be setand the tracked query param tests cover that.Data adapter
getFilters,columnsForType,getRecordsandgetRecordKeywordsreturnedA()as their default. They return[]now, andreleaseMethodsis a native array. Ember read these values only with native methods andget(records, 'length').What still uses the internal
AArrayProxy. It reports.Tests
No test imports from
@ember/array/index-internal. This follows the review from @ef4.trackedArray. That change is Use native and tracked arrays in tests that are not about Ember arrays #21690.A, expect its deprecation, and do not run whenAis removed: tracked Ember array rendering,@eachand[]observers and computed chains, theAtests, the array macro tests, the Ember array cases ofeachand of the conditionals.ignoreDeprecation, the same way as theArrayProxyfixtures. A stub ofdeprecatedoes not nest, so tests that also expect a deprecation use one expectation that matches both messages.Not in this PR
isArrayandmakeArrayfrom@ember/array. RFC 1114 does not list them.enabledversion. Add it when Advance RFC #1114"Deprecating Ember Array"to Stage Ready for Release rfcs#1140 merges.Test results
Local runs of the full suite:
eslinton the changed files andtsc --noEmitalso pass.🤖 Generated with Claude Code