Skip to content

Scroll restoration can throw error when quota is exceeded #6241

Closed

Description

@Xhale1

Which project does this relate to?

Router

Describe the bug

In the rare case that sessionStorage is full (10 MB in modern Chrome), using scrollRestoration: true can cause a crash on navigation.

Failed to execute 'setItem' on 'Storage': Setting the value of 'tsr-scroll-restoration-v1_3' exceeded the quota.

Your Example Website or App

https://stackblitz.com/edit/github-wnddb8nk?file=src%2Froutes%2Findex.tsx

Steps to Reproduce the Bug or Issue

  1. Go to the linked stackblitz
  2. Click the "Fill session storage" button
  3. Click between Home and About a few times to trigger navigations
  4. Observe the error

Expected behavior

I expect Tanstack Router to catch session storage errors and not crash the app. I think adding a try/catch to this bit of code would fix the issue

Screenshots or Videos

No response

Platform

  • Router / Start Version: 1.144.0
  • OS: macOS Tahoe
  • Browser: Chrome
  • Browser Version: 143.0.7499.170
  • Bundler: Vite
  • Bundler Version: 7.3.0

Additional context

No response

Activity

  1. coderabbitai commented on Dec 29, 2025

    @coderabbitai
    Contributor

    📝 CodeRabbit Plan Mode

    Generate an implementation plan and prompts that you can use with your favorite coding agent.

    • Create Plan
    Examples

    🔗 Related PRs

    #4990 - refactor(router-core): scroll-restoration minor performance cleanup [merged]
    #5379 - fix: fix Rest Parameters of react-router-ssr-query [merged]
    #5410 - feat(devtools-core): add history tab [merged]
    #5512 - fix: fallback if origin is 'null' [merged]
    #5839 - docs(solid-router): scroll restoration example [merged]

    👤 Suggested Assignees

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions