Deprecate Evented and @ember/object/events (RFC 1111) - #21491
Closed
NullVoxPopuli-ai-agent wants to merge 6 commits into
Closed
Deprecate Evented and @ember/object/events (RFC 1111)#21491NullVoxPopuli-ai-agent wants to merge 6 commits into
NullVoxPopuli-ai-agent wants to merge 6 commits into
Conversation
Squashed from PR emberjs#20970 by Peter Wagenet, rebased onto current main. Co-authored-by: Peter Wagenet <peter@wagenet.us>
…tibility - Register the deprecation as `deprecate-evented` (since 7.3.0, until 8.0.0), matching the current DEPRECATIONS id conventions - Use deep module imports per current main conventions - Drop the resurrected packages/ember/barrel.ts (deleted on main) - Drop the mixin-deprecation re-exports from the eager utils barrel
setDeprecation(mixin, value) only writes onto its first argument, so when the mixin is file-local (as in @ember/object/evented) the association is unobservable unless the module's bindings are imported — same category as setClassicDecorator and friends. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
NullVoxPopuli-ai-agent
force-pushed
the
deprecate-evented
branch
from
August 3, 2026 20:27
66ad206 to
a4771e6
Compare
The Function -> ((...args: any[]) => void) narrowing in metal/meta only served the internal signatures and forced casts at every call site. Keep the this-aware overloads on the public deprecated surface (@ember/object/events, RouterService) and leave the internal plumbing typed as it was on main, so the diff only carries the deprecation work. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
||
| interface CoreView extends Evented, ActionHandler, View {} | ||
| class CoreView extends FrameworkObject.extend(Evented, ActionHandler) { | ||
| class CoreView extends disableDeprecations(() => FrameworkObject.extend(Evented, ActionHandler)) { |
Contributor
There was a problem hiding this comment.
this strategy can't work for communicating deprecation of these mixins, since deprecations are thrown on methods, not just during definition / constructions
Contributor
Author
There was a problem hiding this comment.
Addressed in b73f967: the framework no longer applies the Evented mixin at all. CoreView/Route/EmberRouter define the methods natively (shared impls in metal/lib/evented-methods), and the definition-time deprecation machinery (mixin-deprecation.ts, the Mixin#reopen hook, disableDeprecations) is deleted — the method-level deprecations are the mechanism.
…ixin CoreView, Route, and EmberRouter now define on/one/off/trigger/has as native class methods delegating to shared standalone implementations (metal/lib/evented-methods), the same shape RouterService already uses. The framework no longer applies the deprecated Evented mixin anywhere, which removes the machinery that existed only to silence internal applications: - utils/lib/mixin-deprecation.ts (setDeprecation/findDeprecation/ disableDeprecations) and the Mixin#reopen DEBUG hook are gone; the deprecation is communicated by the methods themselves. - CoreView's init-time trigger/has swap hack is unnecessary now that the overrides are ordinary class methods. - @ember/object/evented no longer has a top-level setDeprecation call, so the module is side-effect free again and the tree-shakability probe no longer needs to know about setDeprecation. Tests that expected the definition-time "Evented is deprecated" warning now create their objects without a wrapper; method-call deprecations are unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CoreView, Route, and EmberRouter no longer apply the Evented mixin, but their instances still provide its methods. Record Evented in each prototype's meta from a class static block so Mixin#detect keeps answering true for instances and subclasses, exactly as it did when the mixin was applied. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Contributor
|
superseded by #21542 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements RFC 1111: Deprecating
Ember.Eventedand@ember/object/events.This finishes the work started in #20970 (the squashed original work is preserved with @wagenet as author; a follow-up commit rebases it onto current
mainand resolves the open questions).What this deprecates
All under the single id
deprecate-evented(since: { available: '7.3.0' },until: '8.0.0', staged as available only since the RFC is at the Accepted stage):Eventedmixin (via a new internal mixin-deprecation mechanism:setDeprecation/findDeprecationfire inMixin#reopenwhen a deprecated mixin — or a mixin containing one — is applied,DEBUG-only)Eventedmethodson/one/off/trigger/has(including on framework classes like classicComponent,Route, andEmberRouter)addListener/removeListener/sendEventimported from@ember/object/events(deprecating wrappers; the internal@ember/-internals/metalimplementations remain silent)on()event decorator from@ember/object/eventedRouterService exemption
Per the RFC,
RouterService's event methods are not deprecated: it no longer extendsEventedand instead implementson/one/off/trigger/hasdirectly on top of the internal (non-deprecating) listener functions, withrouteWillChange/routeDidChangedocumented types.Framework internals fire no deprecations
CoreView,Route,EmberRouter) are wrapped indisableDeprecations()didInsertElement,willRender, …) andEventDispatcherdispatch now go through new internalsendCoreViewEvent/hasCoreViewListenerhelpers instead ofview.trigger()/view.has()Routeactivate/deactivateandEmberRouterrouteWillChange/routeDidChangeuse internalsendEventdirectlyaddListener/removeListenerThis is proven by the
ALL_DEPRECATIONS_ENABLED=truesuite run: any unexpected deprecation fails a test, and all 9427 tests pass.Differences from #20970
deprecate-evented(was placeholderember-evented), versions updated from 6.12.0 to 7.3.0; the guide in Add deprecation guide for Ember.Evented and @ember/object/events ember-learn/deprecation-app#1404 (evented.md) should be renamed todeprecate-evented.mdand its versions updated to matchmain: deep-path imports (ember-local/no-barrel-imports), the removedpackages/emberbarrel, and the reorganized glimmer internalsVerified locally
ALL_DEPRECATIONS_ENABLED=true,OVERRIDE_DEPRECATION_VERSION=15.0.0, production — 0 failuresOVERRIDE_DEPRECATION_VERSION=15.0.0type-check:internals,type-check:types, eslint, prettier, node tests, docs coverage🤖 Generated with Claude Code