Skip to content
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

Errors when attempting to create a native class extending from Ability #157

Open
mpminardi opened this issue Sep 9, 2022 · 2 comments
Open

Comments

@mpminardi
Copy link

Hi there! I've run into a few cases where I receive the following error while attempting to upgrade to using native classes that extend from Ability:

global failure: Error: You defined the class ExampleAbility that extends from Ember.Object using native class syntax, but you didn't mark it with the @classic decorator. All user classes that extend from this class must be marked as @classic, since they use classic features. If you want to remove the @classic decorator, you must remove the base class. For components, you can do this by converting to Glimmer components. For plain classes that extend from EmberObject, you can convert them into plain native classes that do not extend from EmberObject. If this class is a base class provided by the framework that you should be allowed to remove @classic from, please open an issue on the classic decorators repo: https://github.com/emberjs/ember-classic-decorator

One scenario I've been able to track down that has seemed to cause this is:

  1. Having a native class A that extends from Ability
  2. Having a component B that uses a can helper for A in its handlebars
  3. Having a component C that wraps component B (think of something like C being a dropdown and B being an item for example)
  4. Having a tracked property within component C

Removing the @tracked annotation from the property from component C in that scenario will allow for extending from Ability with no issues. I can work on trying to get a minimal reproducer if that is helpful here.

I've noticed that #151 removes the dependency on EmberObject from Ability which I imagine should resolve this issue without requiring the @classic decorator. Is this pull request still being actively worked on? Would be great to be able to use native class syntax without requiring the decorator.

Thanks in advance for the help. Let me know if I can provide any further information!

@Exelord
Copy link
Collaborator

Exelord commented Sep 11, 2022

Hi Mario :) Yes, this PR should solve it, but I am not sure when I will have time to finish it. It was just a vision.

For know I would recommend to use classic decorator to solve this warning.

@mpminardi
Copy link
Author

Gotcha, thank you for the confirmation Maciej! Will use the decorator in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants