You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tanstack: iOS Safari restores bfcache pages at the top (router-core sets scrollRestoration=manual on persisted pageshow) #835
Package:@decocms/tanstack 7.x (seen on 7.86.0, @tanstack/router-core 1.171.34, @tanstack/react-router 1.170.41).
What happens
On iOS Safari, a page restored from the back/forward cache comes back at the top, even though the browser kept the page (pageshow.persisted === true). Long listings lose the reader's place on every "back" from a product page once the document is bfcache-eligible.
Why
createDecoRouter enables scrollRestoration by default. router-core then registers, in the router constructor (setupScrollRestoration, scroll-restoration.js, from TanStack/router#8519):
On iOS, the persisted pageshow is dispatched before WebKit restores the bfcache scroll position. With "manual" set there, WebKit skips its own restoration, and no navigation happens on a bfcache resume, so the router does not restore it either. Result: scrollY = 0. TanStack/router#8519 itself notes that bfcache resume on Safari was not verified.
Evidence (real iPhone, iOS Safari)
deco-sites/oficina-tanstack, listing /todas-as-roupas served with a bfcache-eligible document (Cache-Control: private, no-cache), "load more" to 80–160 products, scroll down, open a product, swipe back. An on-page diagnostic panel recorded pageshow.persisted and scrollY:
Build
bfcache
scroll after back
as is
yes
0 (was 14 829)
+ a pageshow listener registered after the router that sets history.scrollRestoration = "auto" when persisted
yes
exact, 3/3 (14 811, 22 483, 29 906)
Details and videos: deco-sites/oficina-tanstack#665 (comments of 17/11).
Prior art
SvelteKit restores the current entry's position synchronously inside the persisted pageshow handler (sveltejs/kit#17255); Remix handled iOS scroll on bfcache resume (remix-run/remix#12011).
Proposal
In createDecoRouter, after the router is created (so after router-core's listener), on a persisted pageshow: put "auto" back so the browser restores, then hand scroll back to the router ("manual") on the first scroll event, or after a short timeout when nothing scrolls. PR to follow against 7.x. Worth also reporting upstream in TanStack/router.
Activity
github-actions commentedon Nov 18, 2026
🎉 This issue has been resolved in version 7.87.1 🎉
The release is available on:
blocks-v7.87.1Your semantic-release bot 📦🚀