Skip to content

Commit 657fc44

Browse files
committed
parsePathInput for nonstring inputs
1 parent 2bf3314 commit 657fc44

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/history/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,8 +595,13 @@ export function createHashHistory(
595595
return parsePath(pathname.replace(hashRoot, '/'));
596596
}
597597

598-
function parsePathOutput(pathname) {
599-
return parsePath(pathname.replace('/', hashRoot));
598+
function parsePathOutput(to) {
599+
let path = typeof to === 'string' ? parsePath(to) : to
600+
let pathname = parsePath(pathname.replace('/', hashRoot));
601+
return {
602+
...path,
603+
pathname
604+
}
600605
}
601606

602607
function getIndexAndLocation(): [number, Location] {
@@ -708,7 +713,7 @@ export function createHashHistory(
708713
pathname: location.pathname,
709714
hash: '',
710715
search: '',
711-
...(typeof to === 'string' ? parsePathOutput(to) : to),
716+
...parsePathOutput(to),
712717
state,
713718
key: createKey()
714719
});

0 commit comments

Comments
 (0)