Skip to content

Commit 80df7ed

Browse files
authored
use main view for stale redirect (#4069)
* use main view for stale redirect Closes #4068 * format
1 parent 7ad896e commit 80df7ed

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

assets/js/phoenix_live_view/view.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,14 +1080,17 @@ export default class View {
10801080
`failed mount with ${resp.status}. Falling back to page reload`,
10811081
resp,
10821082
]);
1083-
this.onRedirect({ to: this.root.href, reloadToken: resp.token });
1083+
this.onRedirect({
1084+
to: this.liveSocket.main.href,
1085+
reloadToken: resp.token,
1086+
});
10841087
return;
10851088
} else if (resp.reason === "unauthorized" || resp.reason === "stale") {
10861089
this.log("error", () => [
10871090
"unauthorized live_redirect. Falling back to page request",
10881091
resp,
10891092
]);
1090-
this.onRedirect({ to: this.root.href, flash: this.flash });
1093+
this.onRedirect({ to: this.liveSocket.main.href, flash: this.flash });
10911094
return;
10921095
}
10931096
if (resp.redirect || resp.live_redirect) {

0 commit comments

Comments
 (0)