Skip to content

Commit

Permalink
fix: appended path on fast navigate
Browse files Browse the repository at this point in the history
When navigating in quick succession
check that path starts with /
as else react wll append to
current url.

Fixes #20671
  • Loading branch information
caalador committed Dec 11, 2024
1 parent a784ea1 commit 96fab0c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,10 @@ function Flow() {
// Blocker is handled and the new navigation
// gets queued to be executed after the current handling ends.
const {pathname, state} = blocker.location;
queuedNavigate(pathname.substring(basename.length), true, { state: state, replace: true });
// Clear base name to not get /baseName/basename/path
const pathNoBase = pathname.substring(basename.length);
// path should always start with / else react-router will append to current url
queuedNavigate(pathNoBase.startsWith('/') ? pathNoBase : '/'+pathNoBase, true, { state: state, replace: true });
return;
}
blockerHandled.current = true;
Expand Down

0 comments on commit 96fab0c

Please # to comment.