-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding routes at runtime no longer works #10979
Comments
Can you provide a reproduction? The tests added in that pull request are all passing, so I'm not sure how this is failing without a repro. |
Here is a JSBin running in Ember 1.10.0. Wait two seconds, then click the Foo link. The Bar link is there. http://emberjs.jsbin.com/cogofekuho/2/ Here is the same JSBin running 1.11.3. Clicking the link never shows the Bar link because the route is seemingly never registered. |
Seeing this as well after upgrading to Ember 1.11. Router.map can still be called multiple times, but the actual router instance isn't being remapped when that happens. The tests in the aforementioned commit aren't failing because the second call to Router.map is still happening before app initialization (which IMO doesn't reflect the spirit of the enhancement--in practice the second call to Router.map would happen after initialization). As a temporary workaround I have resorted to mimicking some of the behavior of _initRouterJs after calling Router.map to at least have my new routes recognized:
|
To be honest, I was not aware that we supported lazily defining routes (after app initialization). I'll try to confirm with the rest of the core team, and see if it was intended as a public API. |
Is there any update to this? |
At this point, I would say that dynamically adding more routes after router initialization is not supported. Sorry for keeping this issue open so long... |
Hah I just posted in discuss.emberjs.com about this ... I guess (for now) I'll try @honbo's hack above and see if that works still (hopefully still works 2 yrs later 😬 ) |
uhhh trying to reproduce your success @honbo ... in your snippet, it's adding the |
Ohhhh you run that snippet after calling |
OK got some deprecation warnings but it works! 🎉 |
Issue #2892 allowed new routes to be added at runtime. This appears to no longer function in 1.11.3 or 1.12.0 beta 1.
The text was updated successfully, but these errors were encountered: