-
-
Notifications
You must be signed in to change notification settings - Fork 72
Add Mixin deprecation guide #1408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for ember-deprecations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Co-authored-by: NullVoxPopuli <[email protected]>
since: 6.5.0 | ||
--- | ||
|
||
`Ember.Mixin` is deprecated. This is part of the legacy `@ember/object` API and is not compatible with native classes. Instead of using mixins, you should refactor your code to use class-based patterns. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My strategy for removing mixins from a codebase has been to copy the code into the places that mixed in the mixin and then if there is any common state, extract that to a service. From there I refactor to utilities or to the service to clean it up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarification: Mixins had shared state 😬
} | ||
``` | ||
|
||
Then, apply the decorator to your class: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Showing how to do this with a plain function call rather than decorator syntax might be good.
Especially because we still offer babel-style decorator call signatures, not the standards track stage3 ones.
we should recommend ordering relative to other deprecations. Specifically, using the native class codemod to clear the native class deprecation before attempting to refactor away Mixins is probably the easiest path. (Even though the actual removal in Ember would have a dependency in the opposite order -- we can't remove old-style classes without also removing mixins.) |
RFC: emberjs/rfcs#1116