router-scroll location type breaks non-root routes in development
kpfefferle opened this issue · comments
Create new ember-cli app:
ember new router-scroll-test
cd router-scroll-test
- Remove
ember-welcome-page
addon ember generate route nested
- Add content to
app/templates/nested.hbs
ember serve
- Visit
localhost:4200/nested
(content loads fine)
Introduce ember-router-scroll:
ember install ember-router-scroll
- Follow README setup (import mixin into
router.js
; setlocationType: 'router-scroll'
) - Restart development server with
ember serve
- Visit
localhost:4200/nested
It seems that something in the 'router-scroll'
locationType is breaking the development express server's ability to load the app directly into a non-root route. This is especially frustrating when livereload is constantly refreshing the page during development (triggering this error each time).
Hi @kpfefferle. Thanks for letting us know. I am able to reproduce it.
@bcardarella is working with the ember team to get the router-scroll location API stuff into mainline ember, so I think after that, it might resolve itself, hopefully.
This is really strange. I can see the route exists in Inspector. Still digging.
This isn't happening on my local branch of dockyard.com but I clearly see it in this demo app
I suspect that the HistoryLocation is not working properly after being extended
I believe this is the source of the bug: ember-cli/ember-cli@1171c3d
tldr; ember-cli's HistorySupport middleware that is used to serve up the baseUrl with any nested urls is hard coded to limit to auto
and history
types.
Short-term solution: we can reopen Ember.HistoryLocation
until emberjs/ember.js#14011 is merged in and released. (a few months from now)
@bcardarella do you have plans of dropping in the solution you mentioned? Would love to not have to go back to my root route every time I live reload 😄
I posed it as a possible solution. I'm not the maintainer of the library and was awaiting feedback on the preferred direction.
@kpfefferle @rwwagner90 @bcardarella I finally had a chance to look at this. I was able to get the nested route working by adding this to config/environment.js
locationType: 'router-scroll',
historySupportMiddleware: true, // force the use of the history location middleware
Sweet!
On Thursday, August 18, 2016, Benny C. Wong notifications@github.com
wrote:
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#21 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABIXCtfSFJWfbJAJbzpXIxl6oPI9MMXks5qhM-pgaJpZM4JgsG5
.
Brian Cardarella
CEO of DockYard
Visit us: http://dockyard.com
Call us: (855) DOCK-YRD
Follow me on Twitter: http://twitter.com/bcardarella
Follow us on Twitter: http://twitter.com/DockYard
@bennycwong I can confirm that adding historySupportMiddleware: true
to config/environment.js
fixes the issue for our app as well. Perhaps this should be added to the README setup instructions before the issue is considered resolved entirely? If it's not communicated there, then it may continue to cause frustration for future installs.
Thanks for tracking down a workaround!
#28 has the instructions in the readme. I'm having a hard time explaining how to concisely explain why that config is needed, so I just linked to the issue.