File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 7272- loun4
7373- lqze
7474- lukerSpringTree
75+ - manzano78
7576- marc2332
7677- markivancho
7778- marvinruder
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import {
2727 convertRoutesToDataRoutes ,
2828 invariant ,
2929 isRouteErrorResponse ,
30+ joinPaths ,
3031 matchRoutes ,
3132} from "./utils" ;
3233
@@ -1515,6 +1516,17 @@ export function createRouter(init: RouterInit): Router {
15151516
15161517 let redirectHistoryAction =
15171518 replace === true ? HistoryAction . Replace : HistoryAction . Push ;
1519+ let { basename = "/" } = init ;
1520+
1521+ // If we're operating within a basename, prepend it to the pathname prior
1522+ // to handing off to history.
1523+ if ( basename !== "/" ) {
1524+ navigation . location . pathname =
1525+ navigation . location . pathname === "/"
1526+ ? basename
1527+ : joinPaths ( [ basename , navigation . location . pathname ] ) ;
1528+ }
1529+
15181530 await startNavigation ( redirectHistoryAction , navigation . location , {
15191531 overrideNavigation : navigation ,
15201532 } ) ;
You can’t perform that action at this time.
0 commit comments