Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't short circuit on hash changes if errors exist #13224

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/nice-donuts-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-router": patch
---

Don't short circuit on hash-change only navigations when errors exist since it may be an atempt to resolve the error
3 changes: 2 additions & 1 deletion packages/react-router/lib/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1553,14 +1553,15 @@ export function createRouter(init: RouterInit): Router {
let flushSync = (opts && opts.flushSync) === true;

// Short circuit if it's only a hash change and not a revalidation or
// mutation submission.
// mutation submission (or a potential navigation/revalidation to clear errors).
//
// Ignore on initial page loads because since the initial hydration will always
// be "same hash". For example, on /page#hash and submit a <Form method="post">
// which will default to a navigation to /page
if (
matches &&
state.initialized &&
!state.errors &&
!isRevalidationRequired &&
isHashChangeOnly(state.location, location) &&
!(opts && opts.submission && isMutationMethod(opts.submission.formMethod))
Expand Down