Skip to content

Commit

Permalink
fix: appended path on fast navigate (#20673)
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 authored and vaadin-bot committed Dec 11, 2024
1 parent 75ced33 commit 8cbc4dc
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,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 8cbc4dc

Please # to comment.