-
-
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
Router.js Generics & Route Infos Prep Work #17007
Conversation
Object.defineProperty(transition.state, 'handlerInfos', { | ||
get() { | ||
deprecate( | ||
'You attempted to use "transition.state.handlerInfos" which is a private API that will being removed.', |
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.
will being
should say will be
.
96f8e6f
to
0d222b6
Compare
return this; | ||
} | ||
|
||
const { slice } = Array.prototype; | ||
|
||
const DEPRECATION_MAP = new WeakMap(); | ||
|
||
function deprecatedTransition(transition: Transition) { |
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 should be wrapped for svelting...
|
||
function deprecatedTransition(transition: Transition) { | ||
if (transition.state) { | ||
Object.defineProperty(transition.state, 'handlerInfos', { |
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.
Can we reach in and define this on the base class instead of for each transition?
class PrivateRouter extends Router { | ||
class PrivateRouter extends Router<Route> { | ||
get currentHandlerInfos() { | ||
deprecate( |
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.
should be wrapped for svelting
getHandler(name: string) { | ||
deprecate( |
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.
svelte wrapping
0d222b6
to
d91a4d0
Compare
54e9ac2
to
528a0ec
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.
One somewhat minor nit-pick, but otherwise looks good to me...
@@ -331,7 +332,7 @@ class Route extends EmberObject { | |||
@method _reset | |||
@since 1.7.0 | |||
*/ | |||
_reset(isExiting: boolean, transition: Transition) { | |||
reset(isExiting: boolean, transition: Transition) { |
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.
Seems like this is still private, why is the underscore removed? Also, shouldn't we be worried about userland naming collisions?
528a0ec
to
55bd846
Compare
This PR pulls router.js's generics through Ember's router. It simultaneously introduces the concept of
RouteInfo
.RouteInfo
is what we typically calledHandlerInfo
. While this was a private API we leaked it out indid|willTransition
hooks. Because of that it effectively became intimate API. To compensate for this I have added deprecations around the following private apis_routerMicrolib.currentHandlerInfos
_routerMicrolib.getHandler
transition.handlerInfos
transition.state.handlerInfos
handlerInfos[0].handler
This is based on the usage from EmberObserver
There is going to be a quick follow that is going to expose
transition.to
andtransition.from
along with therouteWillChange
androuteDidChange
events as described by Router Service RFC