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

Implicit Injection Deprecated #2302

Closed
jrjohnson opened this issue May 10, 2021 · 5 comments · Fixed by #2315
Closed

Implicit Injection Deprecated #2302

jrjohnson opened this issue May 10, 2021 · 5 comments · Fixed by #2315

Comments

@jrjohnson
Copy link

On a brand new app ESA is throwing two deprecations as of Ember 3.26.1:

DEPRECATION: A value was injected implicitly on the 'store' property of an instance of <app@session:main::ember176>, overwriting the original value which was null. Implicit injection is now deprecated, please add an explicit injection for this value. If the injected value is a service, consider using the @service decorator. [deprecation id: implicit-injections] See https://deprecations.emberjs.com/v3.x#toc_implicit-injections for more details.
DEPRECATION: A value was injected implicitly on the 'session' property of an instance of <app@service:session::ember177>. Implicit injection is now deprecated, please add an explicit injection for this value. If the injected value is a service, consider using the @service decorator. [deprecation id: implicit-injections] See https://deprecations.emberjs.com/v3.x#toc_implicit-injections for more details
@knownasilya
Copy link
Contributor

knownasilya commented May 13, 2021

Also this breaks in Ember v4 because of this I think. Silently without any errors, just login doesn't work and refreshes the page.

@sly7-7
Copy link
Contributor

sly7-7 commented Jun 2, 2021

@marcoow Do you have any plan how to get rid of these deprecations ?

Currently initializers both regiter and inject the properties. (the session-store into the session, and the session into the session service)
As theses objects are not services, it should be possible to move to the pattern explained here: https://deprecations.emberjs.com/v3.x/#toc_implicit-injections.

If you agree with this direction (defining a getter which use owner.lookup()), I can try to make a PR.

@BobrImperator
Copy link
Collaborator

BobrImperator commented Jun 2, 2021

It looks like this is a correct way to proceed, doesn't seem like anything could break by changing the way we inject dependencies. The only concern would be to check the lookup API maybe, ESA is mostly targeting 3.0+, but If I remember well there have been some changes to looking up registered entities.

@snewcomer
Copy link
Contributor

Thanks for this issue! Btw, this functionality will be removed in v4.0

@josemarluedke
Copy link
Contributor

As Ember v4 beta is out, it would be awesome to have this deprecation fixed.

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