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
Under load (long sessions, many navigations, heavy scroll targets), sessionStorage.setItem for TanStack Router key tsr-scroll-restoration-v1_3 can throw QuotaExceededError / DOMException-shaped quota errors. That bubbles into React and can take down the full UI with:
Failed to execute 'setItem' on 'Storage': Setting the value of 'tsr-scroll-restoration-v1_3' exceeded the quota.
HAPI already wraps sessionStorage.setItem in web/src/lib/scrollStorageGuard.ts (see #611), but a prune-only recovery is insufficient: TanStack keeps the full scroll map in memory; trimming the JSON written to disk does not shrink the in-RAM cache, so the next persist can throw again immediately.
On persist failure for the scroll restoration key (after prune+retry fails, or invalid JSON), clear storage and reset TanStack scrollRestorationCache when guarding real window.sessionStorage (unit tests use a mock Storage and skip the library reset).
Treat any write failure on that key as recoverable for the scroll cache (not only instanceof Error quota shapes).
Follow-up optional hardening: bump @tanstack/react-router / @tanstack/router-core when upstream wraps setItem in try/catch (belt and suspenders).
Suggested verification
From a checkout that includes the merged fix: cd web && bun run test src/lib/scrollStorageGuard.test.ts && bun run typecheck
Manual: long session chat, scroll, navigate until storage is stressed; confirm no uncaught setItem / no white-screen error boundary.
Summary
Under load (long sessions, many navigations, heavy scroll targets),
sessionStorage.setItemfor TanStack Router keytsr-scroll-restoration-v1_3can throw QuotaExceededError / DOMException-shaped quota errors. That bubbles into React and can take down the full UI with:Failed to execute 'setItem' on 'Storage': Setting the value of 'tsr-scroll-restoration-v1_3' exceeded the quota.HAPI already wraps
sessionStorage.setIteminweb/src/lib/scrollStorageGuard.ts(see #611), but a prune-only recovery is insufficient: TanStack keeps the full scroll map in memory; trimming the JSON written to disk does not shrink the in-RAM cache, so the next persist can throw again immediately.Proposed direction (implemented in PR)
scrollRestorationCachewhen guarding realwindow.sessionStorage(unit tests use a mockStorageand skip the library reset).instanceof Errorquota shapes).Follow-up optional hardening: bump
@tanstack/react-router/@tanstack/router-corewhen upstream wrapssetItemin try/catch (belt and suspenders).Suggested verification
cd web && bun run test src/lib/scrollStorageGuard.test.ts && bun run typechecksetItem/ no white-screen error boundary.