Skip to content

Commit b9307d2

Browse files
committed
use main view for stale redirect (#4069)
* use main view for stale redirect Closes #4068 * format
1 parent b3a145e commit b9307d2

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
@@ -1163,14 +1163,17 @@ export default class View {
11631163
`failed mount with ${resp.status}. Falling back to page reload`,
11641164
resp,
11651165
]);
1166-
this.onRedirect({ to: this.root.href, reloadToken: resp.token });
1166+
this.onRedirect({
1167+
to: this.liveSocket.main.href,
1168+
reloadToken: resp.token,
1169+
});
11671170
return;
11681171
} else if (resp.reason === "unauthorized" || resp.reason === "stale") {
11691172
this.log("error", () => [
11701173
"unauthorized live_redirect. Falling back to page request",
11711174
resp,
11721175
]);
1173-
this.onRedirect({ to: this.root.href, flash: this.flash });
1176+
this.onRedirect({ to: this.liveSocket.main.href, flash: this.flash });
11741177
return;
11751178
}
11761179
if (resp.redirect || resp.live_redirect) {

0 commit comments

Comments
 (0)