-
-
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
[Deprecation]: implicit injections #19358
Conversation
06af83b
to
206379c
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.
_internalName!: string; | ||
_names: unknown; | ||
_router: EmberRouter | undefined; |
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.
How can we force this to be just _router: EmberRouter;
?
packages/@ember/-internals/extension-support/tests/data_adapter_test.js
Outdated
Show resolved
Hide resolved
packages/@ember/-internals/extension-support/lib/data_adapter.js
Outdated
Show resolved
Hide resolved
4211123
to
4f4b9f0
Compare
let factory = getFactoryFor(obj); | ||
if (factory) { | ||
for (let injection in factory.injections) { | ||
if (factory.injections[injection] === properties[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.
What is this checking? What is properties
here?
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.
properties
is Object.assign({}, injections, createProps)
basically. So it's possible that the implicit injection has been overridden by an explicit value (an argument in a classic component for instance)
@@ -197,7 +211,9 @@ moduleFor( | |||
assert.equal(result.foo.bar, 'foo'); | |||
} | |||
|
|||
['@test does raise deprecation if descriptor is a getter and not equal to the implicit deprecation'](assert) { | |||
['@test does not raise deprecation if descriptor is a getter and not equal to the implicit deprecation']( |
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.
What this change intended? Based on the code changes, it seems so?
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.
Yes, after thinking about it some more my conclusion was that we can't really assert about getters, specifically because when a user defines a getter, they also must define a setter. Otherwise, the implicit injection will do nothing (or error, if JS strict mode is enabled). With that in mind, its possible that the user could define a setter that swallows the implicit injection, handling the deprecated behavior essentially.
Happy to discuss further if that doesn't make sense
Implements the implicit injections RFC
emberjs/rfcs#680
maybe ref #17791