Skip to content

Ignore malformed persisted scroll position records - #15794

Merged
brophdawg11 merged 2 commits into
remix-run:mainfrom
ragib-mrb:fix/scroll-storage-records
Nov 20, 2026
Merged

brophdawg11 merged 2 commits into
remix-run:mainfrom
ragib-mrb:fix/scroll-storage-records

Conversation

@ragib-mrb

Copy link
Copy Markdown
Contributor

Ignore persisted scroll-position values that are not non-null objects. useScrollRestoration() currently accepts any valid JSON from session storage: null and primitive values throw when positions are saved on page hide, while arrays silently lose string-key positions during serialization.

Start from an empty position map for those values. Regression tests mount the component and dispatch page hide, checking for uncaught errors and verifying the persisted positions. A valid-record control verifies that existing positions are retained.

Testing

  • The broader DOM/router scroll-restoration run passed 835 tests and 446 snapshots with a 20-second per-test limit. The default five-second run timed out in existing special-character loops.
  • Browser integration tests were not run.

@ragib-mrb
ragib-mrb force-pushed the fix/scroll-storage-records branch from 9820144 to 3fe955a Compare November 19, 2026 06:34
@ragib-mrb
ragib-mrb marked this pull request as ready for review November 19, 2026 06:34

@brophdawg11 brophdawg11 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the updated head. The storage-shape guard preserves valid maps and prevents malformed persisted records from throwing or losing saved positions; the base merge leaves the scoped fix unchanged.

Authored by an AI agent on behalf of @brophdawg11

@brophdawg11
brophdawg11 merged commit e6978a6 into remix-run:main Nov 20, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants