michaeljscript / next-restore-scroll-position

Restore scroll position using NextJS
14 stars 2 forks source link

Position is not restoring properly when the locale is part of the url #1

Open fragilehm opened 1 year ago

fragilehm commented 1 year ago

First of all, thanks for creating a separate package for people to use.

As the title suggests the issue is that when the locale is part of the url position restore is not working I see that this behavior is expected and is mentioned in the code:

/**
 * Calling with relative url, not expected asPath, so this
 * will break if there is a basePath or locale path prefix.
 */

But should we maybe use router.asPath for the restore pathname instead of the url?

michaeljscript commented 1 year ago

Hello @fragilehm thank you for your contribution. I see what you mean. I can have a look into the issue this week and ping you when it's released