ember.js: Router Service's `currentURL` does not include `rootURL`

I think this is basically re-opening #16851

The issue is that currentURL does not include the rootURL, where as the other APIs added by the router service RFC (such as urlFor) are explicitly spec-ed to include it.

Given that the motivating use case for the router service is to re-build <LinkTo>, it seems not very likely that it would be correct to use currentURL without rootURL (checking if a link is active maybe?). It is also a bit strange to assume that the RFC would disagree with itself on what “URL” means without calling it out.

To investigate:

  • Did the RFC intend the current behavior? Are there any good use cases for it?
  • Can we still fix it? Is it too late?
  • What do we do? Deprecate and come up with a new name?

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 3
  • Comments: 17 (17 by maintainers)

Most upvoted comments

I’ve published ember-routing-utils in the meantime, which includes removeRootURL(url) and prefixRootURL(url) methods.

transitionTo doesn’t work with rootURL either. But recognize does, which is unfortunate, because for links we get from external sources, we have to first add the rootURL to recognize them and make sure they’re valid, and then remove the rootURL to be able to transition to them.