Skip to content

Commit bdd0dfe

Browse files
committed
Don't short circuit on hash changes if errors exist
1 parent bb81a9a commit bdd0dfe

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/react-router/lib/router/router.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1553,14 +1553,15 @@ export function createRouter(init: RouterInit): Router {
15531553
let flushSync = (opts && opts.flushSync) === true;
15541554

15551555
// Short circuit if it's only a hash change and not a revalidation or
1556-
// mutation submission.
1556+
// mutation submission (or a potential navigation/revalidation to clear errors).
15571557
//
15581558
// Ignore on initial page loads because since the initial hydration will always
15591559
// be "same hash". For example, on /page#hash and submit a <Form method="post">
15601560
// which will default to a navigation to /page
15611561
if (
15621562
matches &&
15631563
state.initialized &&
1564+
!state.errors &&
15641565
!isRevalidationRequired &&
15651566
isHashChangeOnly(state.location, location) &&
15661567
!(opts && opts.submission && isMutationMethod(opts.submission.formMethod))

0 commit comments

Comments
 (0)