We need to load data from the server to determine what some routes will be.
Tried to do Router.map inside an afterModel hook in a route and found that it does not successfully add the route.
Do we need to fetch data in an initializer to do this or… is there some other method to call to add routes at request time? We ideally need a way that will be compatible with fastboot as well. But basically some routes need to be defined based on the URL being hit.
Ember Engines seem to need this lazy-loading route capability as well, however it seems like they can hook in during app initialization, so not sure this will be sufficient for us…
It’s kind of a long story. Suffice it to say we won’t know what the paths are until the first page is requested. Basically different routes based on what subdomain is hit.
But just note, if you are using FastBoot you will run into trouble with this approach because of how Ember keeps a reference of all the Router.map callbacks on the constructor which will leak between requests. If you’re not using FastBoot, it’s safe.