Repository navigation
[EXPERIMENTAL] feat: FastStore's scroll restoration - #3068
Conversation
to handle custom infinite scroll restoration
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
eduardoformiga
left a comment
There was a problem hiding this comment.
LGTM! I tested it now (mobile and desktop) and it worked in build/serve mode.
| // TODO: We won't need to enable this experimental feature when migrating to Next.js 13 | ||
| experimental: { | ||
| scrollRestoration: true, | ||
| scrollRestoration: !storeConfig.experimental.scrollRestoration, |
There was a problem hiding this comment.
Should this be the opposite here? Sounds a little confusing to me.
EDIT: I think I've got it now. When we enable using the experimental feature, we should turn off the next.config one, right?
|
I tested your PR on mobile (Safari). ScreenRecording_10-21-2025.14-35-25_1.MP4 |
This reverts commit 504b5a8.
What's the purpose of this pull request?
From a current Next.js's known issue (discussion#44013), these changes aim to add an experimental custom hook to handle scroll restoration when navigating back from PDPs to PLPs.
Screen.Recording.2025-10-09.at.09.46.56.mov
Along with this experimental hook, some adjustments needed to be made to correct the behavior of related components, such as
Sentinel.While the Next.js experimental
scrollRestorationflag is not working as it should, we are proposing this FastStore's experimental scroll restoration alternative.How it works?
While navigating through PLPs and loading more pages, when users navigate to a PDP and navigate back the scroll should be restored to the last position before the navigation.
Starters Deploy Preview
vtex-sites/faststoreqa.store#878
References
#2054