mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-11 15:34:37 +08:00
Reinitialize JS views on reconnection (#1270)
This commit is contained in:
parent
a4e645defa
commit
e82279d9af
2 changed files with 12 additions and 1 deletions
|
@ -146,6 +146,11 @@ const JSView = {
|
|||
this.props = this.getProps(this);
|
||||
},
|
||||
|
||||
disconnected() {
|
||||
// Reinitialize on reconnection
|
||||
this.el.removeAttribute("id");
|
||||
},
|
||||
|
||||
destroyed() {
|
||||
window.removeEventListener("message", this._handleWindowMessage);
|
||||
|
||||
|
|
|
@ -233,6 +233,10 @@ const Session = {
|
|||
disconnected() {
|
||||
// Reinitialize on reconnection
|
||||
this.el.removeAttribute("id");
|
||||
|
||||
// If we reconnect, a new hook is mounted and it becomes responsible
|
||||
// for leaving the channel when destroyed
|
||||
this.keepChannel = true;
|
||||
},
|
||||
|
||||
destroyed() {
|
||||
|
@ -246,7 +250,9 @@ const Session = {
|
|||
|
||||
setFavicon("favicon");
|
||||
|
||||
leaveChannel();
|
||||
if (!this.keepChannel) {
|
||||
leaveChannel();
|
||||
}
|
||||
},
|
||||
|
||||
getProps() {
|
||||
|
|
Loading…
Add table
Reference in a new issue