From d7aaa6afe89dd11588c546a5fe8a943f13370fb4 Mon Sep 17 00:00:00 2001 From: Manuel Schiller Date: Sun, 27 Oct 2024 00:41:48 +0200 Subject: [PATCH] fix(react-router): correctly set `pathChanged` in router events fixes #2638 --- packages/react-router/src/Transitioner.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-router/src/Transitioner.tsx b/packages/react-router/src/Transitioner.tsx index f3d3d3f4e4..d7850e2fae 100644 --- a/packages/react-router/src/Transitioner.tsx +++ b/packages/react-router/src/Transitioner.tsx @@ -81,7 +81,7 @@ export function Transitioner() { if (previousIsLoading && !routerState.isLoading) { const toLocation = router.state.location const fromLocation = router.state.resolvedLocation - const pathChanged = fromLocation.href !== toLocation.href + const pathChanged = fromLocation.pathname !== toLocation.pathname router.emit({ type: 'onLoad', // When the new URL has committed, when the new matches have been loaded into state.matches @@ -97,7 +97,7 @@ export function Transitioner() { if (previousIsAnyPending && !isAnyPending) { const toLocation = router.state.location const fromLocation = router.state.resolvedLocation - const pathChanged = fromLocation.href !== toLocation.href + const pathChanged = fromLocation.pathname !== toLocation.pathname router.emit({ type: 'onResolved',