Repository navigation
Implement RFC #1216: Deprecate the classic Component - #21630
NullVoxPopuli merged 4 commits into
Conversation
|
this is draft, and thus not ready. I wanted to see how big this PR would be, and then assess what refactoring PRs need to come first |
a09a0d4 to
13514e8
Compare
13514e8 to
4128006
Compare
d0b99e1 to
2ffbc4e
Compare
2ffbc4e to
0fb4143
Compare
0fb4143 to
cee1be0
Compare
86abd0a to
499c0a8
Compare
`getDebugFunction('deprecate')` returned the exported wrapper, not the
current function. A nested `expectDeprecation(fn)` or
`ignoreDeprecation(fn)` saved that wrapper and restored it, so the outer
stub stopped receiving calls.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
499c0a8 to
4f6c2a6
Compare
Add the `ember-component` deprecation, available in 7.6.0 and not enabled. It fires in `init`, once for each instance of the default export of `@ember/component`. Code cannot detect a native `class extends Component`, so `init` is the one place that sees every use. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is mechanical. Hide whitespace to review it. Each file in `components/classic/` puts its code in one `if (!DEPRECATIONS.DEPRECATE_EMBER_COMPONENT.isRemoved)` block. The three tests outside that folder have their own guards. Each test that creates a classic component calls `expectClassicComponentDeprecation()` first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
4f6c2a6 to
6445029
Compare
| case 'deprecate': | ||
| return deprecate; | ||
| // Callers save this value and restore it later with `setDebugFunction`. | ||
| return currentDeprecate ?? deprecate; |
There was a problem hiding this comment.
Without this, a nested expectDeprecation(fn) saves the exported wrapper and restores it, so the outer stub is lost. 13 classic tests expect ember-component for the whole test and also expect a second deprecation in a callback. Those tests failed without this change. It runs in DEBUG builds only.
| init(properties?: object | undefined) { | ||
| super.init(properties); | ||
|
|
||
| deprecateUntil(DEPRECATION_MESSAGE, DEPRECATIONS.DEPRECATE_EMBER_COMPONENT); |
There was a problem hiding this comment.
This fires in init, not when a subclass is defined. Code cannot detect a native class extends Component, and RFC 1117 covers .extend(). A subclass with no instances gets no warning.
| that conflicts with a test that expects other deprecations. | ||
| */ | ||
| export function expectClassicComponentDeprecation(): void { | ||
| if (DEPRECATIONS.DEPRECATE_EMBER_COMPONENT.isEnabled) { |
There was a problem hiding this comment.
This does not use expectDeprecation(msg, false), because that form asserts that no deprecations happen at all. That breaks tests that also expect a different deprecation.
| content: 'bizz bizz', | ||
| }); | ||
| } | ||
| if (!DEPRECATIONS.DEPRECATE_EMBER_COMPONENT.isRemoved) { |
There was a problem hiding this comment.
Each file in components/classic/ gets one guard, not one testUnless for each test. Every test in the folder is a classic component test. Hide whitespace to review: about 850 of the added lines change only the indentation.
| `); | ||
| }, /Using `-with-dynamic-scope` is only supported for `outletState` \(you used `foo`\)./); | ||
| } | ||
| if (!DEPRECATIONS.DEPRECATE_EMBER_COMPONENT.isRemoved) { |
There was a problem hiding this comment.
These templates do not use a classic component. The deprecation comes from the root of ClassicRenderingTestCase. Ember's DynamicScope, and these assertions, exist only below an appendTo root, so this module tests code that is only reachable from a classic component.
| // (`@ember/component`) or a Glimmer component, resolved by name by Ember's resolver. | ||
|
|
||
| @test | ||
| @test({ skip: DEPRECATIONS.DEPRECATE_EMBER_COMPONENT.isRemoved }) |
There was a problem hiding this comment.
These 2 rehydration tests render a classic component. glimmer-workspace has no testUnless, so they use skip.
We don't mark @deprecated until a deprecation is "enabled" Previously: ``` @deprecated Use a Glimmer component (`@glimmer/component`) or a template-only component instead. See https://deprecations.emberjs.com/id/ember-component ```
| DEPRECATE_EMBER_COMPONENT: deprecation({ | ||
| id: 'ember-component', | ||
| for: 'ember-source', | ||
| since: { available: '7.6.0' }, |
There was a problem hiding this comment.
7.6.0 is currently / still main ✔️
…r-component deprecation Main deprecates the classic Component (RFC emberjs#1216, emberjs#21630): Component#init calls deprecateUntil, so a test that creates a classic component fails in the "All deprecations enabled" job (unexpected deprecation) and throws in the "Deprecations as errors" jobs (the deprecation is removed at 8.0.0). Main guarded its own tests; four tests this series added were not: AngleBracket Invocation (URL sanitization of forwarded attributes): a bound URL attribute on a classic component element is sanitized, also on update AngleBracket Invocation (attributes are not arguments): a classic component does not see an attribute as a property Components test: argument names: a classic component gets an argument named SymbolTable a classic component invoked with curlies gets an argument named SymbolTable Each now expects the deprecation and is skipped once it is removed, with `${testUnless(DEPRECATIONS.DEPRECATE_EMBER_COMPONENT.isRemoved)} <name>`, the form the deprecations module documents. testUnless(false) is "@test", so the test names stay the same and native-skip.json and the baselines still match them. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ponents test
Main now declares this test as
`${testUnless(DEPRECATIONS.DEPRECATE_EMBER_COMPONENT.isRemoved)} @test classic components`
(emberjs#21630). testUnless(false) is itself "@test", so the
QUnit name became " @test classic components" instead of
" classic components". native-skip.json matches tests by name, so the
gxt-native page stopped skipping this documented-drop test, ran it and
failed the native gate:
green->red: Application test: debug render tree :: @test classic components
The skip entry and the native baseline's skipped-test name now use the
new name. Nothing else in the GXT skip lists or baselines refers to a test
main renamed.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Adds the
ember-componentdeprecation for the classicComponentclass, the default export of@ember/component. RFC: emberjs/rfcs#1216The deprecation is available in 7.6.0 and is not enabled. It gets an
enabledversion when the RFC is Ready for Release (rfcs#1227).This PR restarts from
main. It sits on #21775, which moved the test harness to a Glimmer root.What changes
DEPRECATE_EMBER_COMPONENT: idember-component, until8.0.0.init, once for each classic component instance.@deprecated, with a link to the guide.@ember/componentdo not change.Difference from the RFC
The RFC says that the deprecation fires when the class is extended or instantiated. This PR fires only at instantiation:
class extends Component.Component.extend()alone does not fire. RFC 1117 covers.extend()separately.A subclass with no instances gets no warning. Every class that renders does.
Review
getDebugFunction('deprecate'). It returned the exported wrapper, so a nestedexpectDeprecation(fn)dropped the outer expectation.components/classic/puts its code in oneif (!DEPRECATIONS.DEPRECATE_EMBER_COMPONENT.isRemoved)block.testUnlessindebug-render-tree-test.tsand inoutlet-inside-component-test.js.ifblock around the{{-with-dynamic-var}} (classic root)module.@test({ skip }).expectClassicComponentDeprecation()expects nothing while the deprecation is not enabled. The usualisEnabledfalse form conflicts with other enabled deprecations in the same test.Verified locally
All 9 CI variants pass. The default run has 9301 tests. The deprecations-removed run has 8022 tests, with 626 skipped.
type-check:internals, eslint, and prettier pass.Not in this PR
The deprecation guide in ember-learn/deprecation-app.
🤖 Generated with Claude Code