-
-
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
Add deprecation for Route#render
method
#19442
Add deprecation for Route#render
method
#19442
Conversation
Defaults to the return value of the Route's model hook | ||
@private | ||
*/ | ||
_render(name?: string, options?: PartialRenderOptions) { |
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.
Refactors render
to be _render
, and call that from within renderTemplate
and render
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.
Let's use the symbol
utility method from @ember/-internals/utils
to make something more truly private.
d26e57b
to
51d3614
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.
Implementation generally looks good, only had a couple small suggestions.
Defaults to the return value of the Route's model hook | ||
@private | ||
*/ | ||
_render(name?: string, options?: PartialRenderOptions) { |
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.
Let's use the symbol
utility method from @ember/-internals/utils
to make something more truly private.
let renderOptions = buildRenderOptions(this, name, options); | ||
ROUTE_CONNECTIONS.get(this).push(renderOptions); | ||
once(this._router, '_setOutlets'); | ||
deprecate('Usage of `render` is deprecated.', false, { |
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.
Lets include some more information in the deprecation message. I'm thinking this.routeName
at least...
@rwjblue I think I understand the const RENDER = symbol('render');
// internal functionality now declared outside the class
function _render(name, options) {
let renderOptions = buildRenderOptions(this, name, options);
ROUTE_CONNECTIONS.get(this).push(renderOptions);
once(this._router, '_setOutlets');
}
class Route extends EmberObject implements IRoute {
constructor() {
// ... snip ...
// Make sure to bind to `this`
this[RENDER] = _render.bind(this);
}
// ... snip ...
renderTemplate(name, options) {
this[RENDER]();
}
} |
Something more like: const RENDER = symbol('render');
class Route extends EmberObject implements IRoute {
[RENDER]() {
// the implementation here
}
render() {
// issue a deprecation
return this[RENDER](...arguments);
}
} |
eda0c85
to
dcf0819
Compare
dcf0819
to
7765a67
Compare
@rwjblue I've incorporated your feedback so I think it should be good to go now |
Thank you! |
Adds deprecation for
Route#render
. See RFC 418 for more info. This deprecation has the same id/url asRoute#renderTemplate
as they were part of the same RFC.