next-router-scroll icon indicating copy to clipboard operation
next-router-scroll copied to clipboard

Check the new scroll restoration feature in Next.js

Open satazor opened this issue 5 years ago • 2 comments

https://github.com/vercel/next.js/pull/13914/files#diff-5eff10c96fa6858c659318492c4cf7f7

It seems that the X and Y coordinates are being stored in the router state, meaning perhaps we can leverage those instead of saving into the local storage.

satazor avatar Aug 04 '20 13:08 satazor

Currently, next-router-scroll spam this message when a user disabled localStorage:

SecurityError: Failed to read the 'sessionStorage' property from 'Window': Access is denied for this document.
If the user disables Local Storage, this message will be spam in the browser console.

And it sent a lot of logs to my sentry. If the feature is implemented. it will fix this problem.

meotimdihia avatar Feb 08 '21 01:02 meotimdihia

@satazor they have already discarded the idea to persist scroll in the router state. Also the built-in solution doesnt provide any control of when we need to restore and in what cases, as well as the ability to persist the scroll of any element. We still need this library :)

RainGrid avatar Dec 01 '22 07:12 RainGrid