-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
There are two invariants maintained by AutoLocation via assertions that have caused a regression in Skylight. I don't know exactly what change caused this to break, and I'm trying to untangle the thread, but the bottom line is I believe AutoLocation is too aggressive and should handle this case more gracefully.
The two invariants causing problems are:
- AutoLocation enforces that
rootURLmust always end with a slash/. So, for example, if we set therootURLto/app, it will raise an exception unless we change it to/app/. - AutoLocation verifies that the
rootURLis contained in the URL inside_getHistoryPath(), and raises an exception if not (https://github.com/emberjs/ember.js/blob/master/packages/ember-routing/lib/location/auto_location.js#L240)
This is problematic because our Ember app is served by our Rails app, and links generated by Rails link to, you guessed it, /app (no trailing slash).
At some point, our app started throwing exceptions when hitting localhost:4200/app directly instead of /app/. Perversely, everything works fine if I comment out the above-linked assertion, so it seems like it's not doing much. (In that case, Ember automatically redirects to /app/ from /app.)
I don't know the most robust way to handle this case, but it seems like we should loosen the constraints on rootURL and automatically do the normalization in code, rather than pushing complexity to the user.
cc/ @cibernox @jayphelps