-
-
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
[BUGFIX beta] Adds a deprecation message when using targetObject #14590
[BUGFIX beta] Adds a deprecation message when using targetObject #14590
Conversation
This is good for the specifying of a The thought was that we would need to use an actual JS getter with a deprecation for that. Something like: import { descriptor } from 'ember-metal';
// ...snip...
targetObject: descriptor({
get() {
deprecate('good message', false, { until: '2.12.0', url: 'some-path', id: 'ember-views.targetObject' });
return this._targetObject;
},
set(value) {
deprecate('good message', false, { until: '2.12.0', url: 'some-path', id: 'ember-views.targetObject' });
return this._targetObject = value;
}
}) |
7069fb9
to
dd9f51a
Compare
Thanks, @rwjblue. That was really helpful. |
dd9f51a
to
ce83c99
Compare
Tried that @pixelhandler, but then ran into tests failing as classes that include the There's a few places where the framework iterates over all properties in an object so It didn't feel right to add special-case handling in these places as they were a consequence of adding the code to the mixin which is why we came up with the |
ce83c99
to
a2930ef
Compare
Ya, we have to make it non-enumerable (which will cause it to not show up in list of keys). |
32017e5
to
65a57f1
Compare
I totally missed that option 😅. Have rebased and udpated the PR accordingly. |
a22a251
to
c279d9e
Compare
What's the best way to silence deprecations within the framework itself? The build is currently failing in the production suite because I want to silence deprecations here: |
Is the idea to use In Ember 2.7 we used to be able to read and set targetObject. It's gone in 2.9, but using _targetObject worked. While both are private they worked. By reading this, if I understood correctly the idea is to use We have inside a component wrapper something like:
I understand based on the deprecation warning that we were supposed to use
What worked across versions was, but that's supposed to be deprecated is reading from
|
@@ -159,5 +165,23 @@ function getTarget(instance) { | |||
} | |||
} | |||
|
|||
registerHandler(function(message, options, next) { |
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 think we should remove this line and the line below that does target = get(instance, 'targetObject')
(so that we don't trigger the deprecation).
Things should fall through now that we have the getter/setter above.
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.
👍 Updated
6e9d228
to
c5eae9d
Compare
|
||
function _deprecateTargetObject() { | ||
let message = 'Usage of `targetObject` is deprecated. Please use `target` instead.'; | ||
let options = { id: 'ember-runtime.using-targetObject', until: '2.15.0' }; |
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.
Changed this to 2.15.0
. Perhaps we'd like it to be a later version, if so which?
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.
Ya, it will need to be 2.17.0 at this point.
c5eae9d
to
4090175
Compare
@rwjblue Thanks! Updated. |
@rwjblue it would be good to get this merged. As it's been ~6 weeks since the deprecation target was set to |
configurable: true, | ||
enumerable: false, | ||
get() { | ||
_deprecateTargetObject(); |
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.
Unfortunately, I think we actually want to duplicate the code for this helper method so that it can properly be stripped from production builds.
Can you move the code into both the get
and set
directly?
return null; | ||
} | ||
|
||
function _deprecateTargetObject() { | ||
let message = 'Usage of `targetObject` is deprecated. Please use `target` instead.'; |
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 think we should pass a bit more debugging info here. If I saw this message in the console, I'm not sure how I would track down where it was coming from. Perhaps you can include this
(which will display something like <component:foo-bar#1234>
which might give someone a clue...).
|
||
function _deprecateTargetObject() { | ||
let message = 'Usage of `targetObject` is deprecated. Please use `target` instead.'; | ||
let options = { id: 'ember-runtime.using-targetObject', until: '2.17.0' }; |
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've let this slip yet again, and I am very sorry. Can you update this again to 3.5.0?
4090175
to
24a32b1
Compare
@rwjblue Updated! 🙇 |
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.
Thank you very much for your patience and hard work here. Sorry for all the delays, great work! 👏👏🎉
For #14168
@rwjblue is this enough or should we also assert when setting
targetObject
? If so, where might I add that check?