Closed soerenbf closed 4 years ago
Could you describe a little more about the scenario that isn't working? Maybe it's obvious, but I haven't looked at this code in awhile.
Of course! The app I'm working on is server side rendered, thus the entire DOM for the first page is available on first paint in the browser. What then happens is:
WindowScroller
mounts_restoreWindow
on ScrollManager
location.hash
If you have a look at the PR #12 , the change is pretty simple, and will only have an effect hash
is set on location
.
Thanks for the explanation. I've never used SSR myself, but that makes sense. I was worried about how this might affect deferred scrolling of hash links to dynamically rendered content, but after reviewing the code, it doesn't attempt to do that on initial mount anyway. I've merged the change and will get a new release out soon.
Version 1.0.3 includes this fix.
Awesome! Thanks!
I guess the
history.listen
event isn't fired on load, but only successive navigations? Anyway, maybe we could check forlocation.hash
on the initialrestoreWindow
call onScrollManager
?I'll see if I can get around to submitting a PR, and you can have a look @trevorr ?