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

Cannot Use with Ember 3.11 #204

Closed
jherdman opened this issue Jul 23, 2019 · 4 comments
Closed

Cannot Use with Ember 3.11 #204

jherdman opened this issue Jul 23, 2019 · 4 comments

Comments

@jherdman
Copy link

jherdman commented Jul 23, 2019

Version

3.5.8

Test Case

Install this addon in a new Ember 3.11 project, and have a classic component like this:

export default Component.extend(InviewportMixin, {
  // etc
});

Steps to reproduce

Boot up your test suite

Expected Behavior

Ember runs

Actual Behavior

Ember reports the following error:

Uncaught Error: Assertion Failed: You must call `this._super(...arguments);` when overriding `init` on a framework object. Please update <my-app@service:-observer-admin::ember1455> to call `this._super(...arguments);` from `init`

It took a little head scratching, but it seems that there's some kind of mismatch between the use of native classes in this addon, and classic ember components. The resolution was to refactor to native classes in the host app. This, however, is a bit surprising, and seems to suggest a breaking change.

EDIT: This is breaking addons that have components that use this mixin too.

@snewcomer
Copy link
Collaborator

Hey @jherdman! Yeah in the case you are showing, we have a mix of framework objects that extend() (the mixin) and native classes (the service). You are right it does suggest a breaking change. I think it might be worthwhile to try and see if refactoring the mixin to a native class helps.

@jherdman
Copy link
Author

Is there any particular reason that the mixin couldn't simply be a component subclass that consumers of this lib subclass in turn? As it is it feels a little awkward to use:

export default MyComponent extends Component.extend(TheMixin) {
  // blah
}

@snewcomer
Copy link
Collaborator

Ah you might have another dependency that is clobbering the 3.5.8 version. observer-admin is not a service anymore. Can you check with ember-cli-dependency-lint?

@jherdman
Copy link
Author

You are indeed correct. Resolving this fixed the root problem.

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