Skip to content
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

Causes scroll jumps when going back and forward in browser #88

Open
kedrzu opened this issue Feb 2, 2021 · 2 comments
Open

Causes scroll jumps when going back and forward in browser #88

kedrzu opened this issue Feb 2, 2021 · 2 comments

Comments

@kedrzu
Copy link

kedrzu commented Feb 2, 2021

I use this library along with Nuxt and basic vue-router in SSR / static mode.

Reproduce steps:

  1. Render page. Everythings loads fine (statically), lazy hydration works perfectly.
  2. Scroll somewhere down.
  3. Go to some other page. This is standard SPA navigation to some other page using vue-router. Still works like charm.
  4. Click back in your browser.

And here's the deal: when going back, vue-router tries to scroll user to the same position he was before.
But lazy-hydrate works basing on Promise now, and that causes a slight delay in component rendering. So at the time router scrolls down, components are not rendered yet. Effectively, you land on the bottom of the page (or in some other bad place).

The previous version (v1) worked differently, basing on some Virtual DOM hacks. The problem does not appear there.

@maoberlehner
Copy link
Owner

Thank you for your detailed issue report. Still, providing a reproduction app (CodeSandbox or GitHub repo) would make it easier for me to work on this, which will make it more likely that I'll work on this sooner.

@kedrzu
Copy link
Author

kedrzu commented Oct 15, 2021

I made a fix for the issue: #113
I use it in a production application and works like charm. Can you take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants