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

Ember uses deprecated features #17964

Closed
kanongil opened this issue Apr 24, 2019 · 9 comments · Fixed by #17974
Closed

Ember uses deprecated features #17964

kanongil opened this issue Apr 24, 2019 · 9 comments · Fixed by #17974

Comments

@kanongil
Copy link
Contributor

kanongil commented Apr 24, 2019

The events.inherited-function-listeners deprecation triggers from within ember itself.

The triggered method:

function contentPropertyDidChange(content, contentKey) {
let key = contentKey.slice(8); // remove "content."
if (key in this) {
return;
} // if shadowed in proxy
notifyPropertyChange(this, key);
}

@pzuraq
Copy link
Contributor

pzuraq commented Apr 24, 2019

Listeners are inherited lazily, so there's no way for us to know ahead of time that they will cause a deprecation. When we first notify a property that causes the listener to fire, we collapse the inheritance tree and encounter the issue, throwing the deprecation message.

You should look through your code to see where you are doing addListener or addObserver with a function to see where this might be coming from. Alternatively, you can place a breakpoint at the deprecation itself, and log the function there, it should link you back to the actual function, which should help you find where it is being added.

@kanongil
Copy link
Contributor Author

@pzuraq It is not my code:

addObserver(this, contentKey, null, contentPropertyDidChange);

@pzuraq
Copy link
Contributor

pzuraq commented Apr 24, 2019

If that's the deprecation message you are seeing, I believe this is a different listener that is being triggered by that observer. Those observers are only ever added to instances, the willWatchProperty function is never called on a prototype, and could not trigger this message.

If you still need to debug this, please put a breakpoint at the location of the deprecation and log the function, so we can be sure.

@kanongil
Copy link
Contributor Author

It's an ember issue, replicated with this command:

Ember.ObjectProxy.extend({ a: function () {}.observes('b') }).create()

@pzuraq
Copy link
Contributor

pzuraq commented Apr 25, 2019

That's not supported anymore, and trying that out locally I get a different deprecation:

DEPRECATION: Function prototype extensions have been deprecated, please migrate from function(){}.observes('foo') to observer('foo', function() {}). [deprecation id: function-prototype-extensions.observes]

I don't get the deprecation you're describing.

@pzuraq
Copy link
Contributor

pzuraq commented Apr 25, 2019

My mistake actually, I was able to reproduce this after switching to an older version of Ember. You are correct, this is a bug, will submit a fix shortly. Sorry again for the confusion, it's been a long week!

@BillyRayPreachersSon
Copy link

BillyRayPreachersSon commented Jun 14, 2019

I'm working though upgrading our app from 3.4 LTS to 3.8 LTS. I've removed 7500+ of the events.inherited-function-listeners deprecation warnings from our CI test logs, but are left with 8, and they all come from the same internal code in @ember/-internals/runtime/lib/mixins/-proxy.js.

We're using ember-cli 3.8.3 and ember-source 3.8.0.

Will this fix be backported, so that 3.8 LTS users get the benefit?

Thanks!

@rwjblue
Copy link
Member

rwjblue commented Jun 14, 2019

[email protected] already includes this fix, please update 😸

@BillyRayPreachersSon
Copy link

[email protected] already includes this fix, please update 😸

Perfect, down to 0 warnings (of that type, at least). Thanks!

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

Successfully merging a pull request may close this issue.

4 participants