Skip to content

Upgrade @tanstack/react-router — upstream already has built-in scroll-restoration quota fix #683

@swear01

Description

@swear01

What version of HAPI is running?

0.18.3

What platform is your computer?

Linux 6.17.0-1007-oracle aarch64 aarch64

What issue are you seeing?

The error still surfaces when sessionStorage quota is full:

QuotaExceedError: Failed to execute 'setItem' on 'Storage': Setting the value of 'tsr-scroll-restoration-v1_3' exceeded the quota.
HAPI depends on @tanstack/react-router@^1.143.6 (router-core@1.143.6, published 2025-12-24). That version's scroll-restoration module calls sessionStorage.setItem without try-catch, allowing the error to propagate.

The existing workaround (web/src/lib/scrollStorageGuard.ts) catches this error, but isQuotaError() only matches two error names:

err.name === 'QuotaExceedError' || err.name === 'NS_ERROR_DOM_QUOTA_REACHED'
Some browser environments may throw a different error name, causing the guard to re-throw instead of silently handling it.

What steps can reproduce the bug?

Accumulate enough session / file routes (sessionStorage cache exceeds ~5MB), then navigate between pages.

What is the expected behavior?

The QuotaExceedError should not be thrown.

Additional information

Upstream fix:

TanStack/router PR #6287 — wraps sessionStorage.setItem in try-catch, logs a warning instead of throwing.
Merged: 2026-01-05
Included from @tanstack/router-core >= 1.145.6.
This was available 4 months before HAPI issue #611 was filed (2026-05-11).
HAPI workaround:

PR #632 — scrollRestorationKey.ts (key collapsing) + scrollStorageGuard.ts (error guard), merged 2026-05-18.
The PR did not discuss upgrading the dependency; likely the upstream fix was not known at the time.
Suggestion: upgrade @tanstack/react-router to latest (currently 1.171.6) and remove the custom guard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions