Why should I avoid transitionTo and full URLs?


#1

The API documentation for Route.transitionTo states:

It is also possible to pass a URL (a string that starts with a /). This is intended for testing and debugging purposes and should rarely be used in production code.

Could someone elaborate on this reasoning? I often use URL paths because they just work. It would be helpful to know what problems this could cause.


#2

I am not certain why that phrasing is used so I decided to go spelunking. That part of the docs was added waaaayyy back in 2014 (in emberjs/ember.js#4403).

I personally do not understand the reasoning for suggesting its only good for testing/debugging, and find (at times) for URL based transitions to be quite nice.


#3

Thank for you the insight! I’ve instinctively been doing this and telling teammates so we keep to the herd. I’ll submit a PR to remove this wording as I think it adds unnecessary teaching overhead regarding proper use of routing methods.


#4

One reason I can see is if you change the path of a route. In that case you are tightly coupling to the specific wording (notice I’m not talking about structure/nesting) of a route if you use this method.