-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[CLEANUP beta] Deprecate owner.inject #19680
Conversation
a11ae84
to
bd3db85
Compare
fbbd92b
to
2a2ea04
Compare
@snewcomer can the cleanup/removal of the old API land in its own PR with |
@mixonic So this timeline took me a bit to grep but is laid out in this RFC .
Sry if the above was rehashing something you already know. But the deprecation + removal of the supporting infrastructure for @pzuraq noted we could assert as well. I think that was only if we didn't wrap up the work that is in this PR in time. |
this.component = CoreOutlet.create(); | ||
let outletTemplateFactory = this.owner.lookup('template:-outlet'); | ||
let environment = this.owner.lookup('-environment:main'); | ||
this.component = CoreOutlet.create({ environment, template: outletTemplateFactory }); |
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.
☝️ this is important to note. This was refactored from the implicit injection.
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.
I believe this needs to be ported to @ember/test-helpers
https://github.com/emberjs/ember-test-helpers/blob/9219247259ef6b4d8a339ca71a1374e2ffe69603/addon-test-support/%40ember/test-helpers/setup-rendering-context.ts#L266
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.
working on that now.
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.
landed and released as @ember/test-helpers@2.4.2
6a75dd5
to
e22a8fa
Compare
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.
So I believe that _lazyInjections
can also be removed as part of this work. As far as I can tell, it's basically creating and setting up lazy versions of implicit injections, only in DEBUG, and I can't see any usage in the ecosystem at all: https://emberobserver.com/code-search?codeQuery=_lazyInjections
It's explicitly marked as a private API as well, so should be fine to remove. Overall this PR looks amazing and once those changes are made, I think we're good to merge!
assertResources('/b', ['/b', '/c']), | ||
assertResources('/c', ['/c']), | ||
assertResources('/d', ['/d', '/e']), | ||
assertResources('/e', ['/e']), |
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.
I don't think the intention here was parallel. So I made it serial. This was also due to the fact that creating a singleton service per app instance that tracked "network" requests in each route was proving difficult when they happen in parallel. Lmk if anybody has any comments here.
@@ -32,7 +32,6 @@ module.exports = { | |||
'_helpers', | |||
'_hydrateUnsuppliedQueryParams', | |||
'_initializersRan', | |||
'_injections', | |||
'_internalReset', | |||
'_invoke', | |||
'_lazyInjections', |
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.
I checked out lazyInjections
and it looks like it is used to validate service injections and not implicit.
ember.js/packages/@ember/-internals/glimmer/tests/integration/components/curly-components-test.js
Line 2898 in b818f54
['@test injecting an unknown service raises an exception']() { |
@snewcomer I don't understand the statement:
Deprecated functionality is not removed, it is merely warned against in development builds. Do you mean "if a user were to use an explicit injection as suggested by the deprecation message, then any edit: Ok, I see what you're going for. |
{ | ||
id: 'remove-owner-inject', | ||
until: '5.0.0', | ||
url: 'https://deprecations.emberjs.com/v3.x#toc_implicit-injections', |
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.
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.
If you can update the link here to point to the correct 4.x deprecation page we can land this PR independent of ember-learn/deprecation-app#932, IMO
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.
ok fixed!
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.
Awesome stuff here @snewcomer !
6ed912e
to
cfad78f
Compare
Force pushed a single commit for a clean history, letting CI run. |
I believe this currently incompatible with This broke embroider's canary tests: embroider-build/embroider#932 @mixonic My work on embroider has been nontrivially impact due to Anyways, adding at-least |
@stefanpenner I would be happy to add this. I love adding this type of regression testing! |
ember-canary requires `template` + `environment` be provided to the view. This seems like a reasonable change, but does require “low level” libraries such as `@ember/test-helpers` to make some changes. (Ember PR emberjs/ember.js#19680)
@snewcomer awesome. At the very-least, I think ember could get lots of milage out of smoke testing |
proposed fix for |
@snewcomer also, if you have cycles a small inline comment in ember.js, specifically around #19680 (comment) to inform authors that changes need to be made in parallel with Ultimately, having ember provide a "public api" for test-helpers to tap into here could prove to be the best long-term solution. But may not be the most pragmatic choice right now. |
description of problem: emberjs/ember.js#19680 (comment) fix in @ember/test-helpers: emberjs/ember-test-helpers#1110
Fix for my above issue landed as @ember/test-helpers@2.4.2 |
* [fixes #932] fix ember-canary test scenario description of problem: emberjs/ember.js#19680 (comment) fix in @ember/test-helpers: emberjs/ember-test-helpers#1110 * [fixes ember-canary/ember-beta] migrate ember-cli-template-lint -> ember-template-lint Ember-cli-template-lint is deprecated, and now incompatible with ember 4.x
@stefanpenner This PR to smoke test ember-test-helpers, ember-string and ember-legacy-built-in-components is passing now! Would appreciate a review if you have some time. |
RFC: emberjs/rfcs#680
See https://github.com/emberjs/rfcs/blob/sn/owner-inject-deprecation/text/0680-implicit-injection-deprecation.md#1-deprecate-implicit-injection-on-target-object for the reasons why we first added the initial deprecation in
3.26.0
and are now adding another deprecation but removing the functionality ofapp.inject
.injection
ref #19617