You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem I encountered is that all the links are active independently of the actual context object used. In other words, no matter which band link is transitioned to, is-active returns true for all of the links in the list:
I drilled down into the code to see what causes this and I've found that the router service polyfill calls the router's isActiveIntent method, which in turn calls NamedTransitionIntent.applyToHandlers (see here) to decide if the link generated is an active one.
this.modelFor(routeName) only works for parent routes of the current route.
There might be a way to imitate what link-to does to see if a route is active (I assume that's why you want to get the current model for that route, too), but it seems to use a fair amount of private APIs (which is what the router service would solve).
I have the following code where I wanted to replace
link-to
withember-href-to
and using the router service to calculate theactive
class:The problem I encountered is that all the links are active independently of the actual context object used. In other words, no matter which band link is transitioned to,
is-active
returns true for all of the links in the list:I drilled down into the code to see what causes this and I've found that the router service polyfill calls the router's
isActiveIntent
method, which in turn callsNamedTransitionIntent.applyToHandlers
(see here) to decide if the link generated is an active one.However,
NamedTransitionIntent.applyToHandlers
clobbers the context by copying one contextover the other (see here), and will subsequently find that the handlers are equal and thus return true for
isActiveIntent
.I also checked that
link-to
works fine for this scenario, very probably because it uses another code path to determine if a link is active.The code I tested this with can be found on the router-service branch of balinterdi/rarwe-demo.
The text was updated successfully, but these errors were encountered: