Skip to content

Conversation

joseph0926
Copy link
Contributor

Fixes: #14325

Fixes navigation errors that occur when browser storage (localStorage/sessionStorage) is blocked for any reason.
(In my case, I confirmed this occurs when “Do not save data” is enabled in Chrome.)

Problem

When users block cookies/storage in their browser settings, React Router v7 throws an unhandled SecurityError during client-side navigation, causing the application to show "Application Error" instead of navigating properly.

Solution

Added try-catch blocks around sessionStorage access in fog-of-war.ts to handle storage access errors,

Test Instructions

Manual Testing

  1. Visit https://reactrouter.com
  2. Open Chrome settings → Site settings → Cookies → Block all cookies
  3. Navigate to /docs page
  4. Go back to the home page(the security console error mentioned earlier appears here)
  5. Navigate to /docs page
  6. Page is broken

Integration Test

Added integration test in session-storage-denied-test.ts that simulates blocked storage and verifies navigation still works.

Note

Referencing other catch blocks, I did not add any separate logs or similar to the catch block. I simply left a comment.

Copy link

changeset-bot bot commented Sep 15, 2025

⚠️ No Changeset found

Latest commit: d0a4ac3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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.

1 participant