Skip to content

Commit 11c6094

Browse files
fix: router.push to external links should not use history
1 parent 021c2e8 commit 11c6094

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

solara/widgets/vue/navigator.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,14 @@ modules.export = {
6767
watch: {
6868
location(value) {
6969
console.log("changed", this.location, value);
70-
pathnameNew = (new URL(value, window.location)).pathname
71-
pathnameOld = window.location.pathname
70+
const newUrl = new URL(value, window.location);
71+
if(newUrl.origin != window.location.origin) {
72+
// external navigation
73+
window.location = newUrl;
74+
return
75+
}
76+
const pathnameNew = newUrl.pathname
77+
const pathnameOld = window.location.pathname
7278
// if we use the back navigation, this watch will trigger,
7379
// but we don't want to push the history
7480
// otherwise we cannot go forward

0 commit comments

Comments
 (0)