Next.js Discord

Discord Forum

Why router.refresh() reset scroll for previous page

Unanswered
Oriental Pratincole posted this in #help-forum
Open in Discord
Oriental PratincoleOP
When calling next/navigation router.refresh() and go back to previous page scroll state is lost?

6 Replies

@Oriental Pratincole When calling next/navigation router.refresh() and go back to previous page scroll state is lost?
router.refresh invalidates the browser cache. Iirc the scroll position is part of the cache. You can see it here: https://nextjs.org/docs/app/building-your-application/caching#opting-out-3
Oriental PratincoleOP
Is it possible only to refresh data and preserve scroll state?
@Oriental Pratincole solved?
Oriental PratincoleOP
No, I'm still looking for a solutions 😦
Oriental PratincoleOP
I created issue, but still no response https://github.com/vercel/next.js/issues/67006