Skip to content

Commit 6aa38f1

Browse files
committed
fix(solid-router): handle cross-origin navigation in Transitioner component
Signed-off-by: leesb971204 <[email protected]>
1 parent e8757e3 commit 6aa38f1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/solid-router/src/Transitioner.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ export function Transitioner() {
5454
const nextPublicHref = trimPathRight(nextLocation.publicHref)
5555

5656
if (latestPublicHref !== nextPublicHref) {
57+
const latestOrigin = new URL(router.latestLocation.url).origin
58+
const nextOrigin = new URL(nextLocation.url).origin
59+
60+
if (latestOrigin !== nextOrigin) {
61+
if (typeof window !== 'undefined') {
62+
window.location.href = nextLocation.url
63+
}
64+
return
65+
}
66+
5767
router.commitLocation({ ...nextLocation, replace: true })
5868
}
5969

0 commit comments

Comments
 (0)