mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-10 23:14:35 +08:00
Reinitialize cell editor on reconnection (#1146)
This commit is contained in:
parent
d11084d32f
commit
25e5d874be
2 changed files with 12 additions and 5 deletions
|
@ -86,10 +86,7 @@ const Cell = {
|
|||
},
|
||||
|
||||
disconnected() {
|
||||
// When disconnected, this client is no longer seen by the server
|
||||
// and misses all collaborative changes. On reconnection we want
|
||||
// to clean up and mount a fresh hook, which we force by ensuring
|
||||
// the DOM id doesn't match
|
||||
// Reinitialize on reconnection
|
||||
this.el.removeAttribute("id");
|
||||
},
|
||||
|
||||
|
|
|
@ -29,7 +29,9 @@ const CellEditor = {
|
|||
|
||||
this.liveEditor.onMount(() => {
|
||||
// Remove the content placeholder
|
||||
editorContainer.querySelector(`[data-el-skeleton]`).remove();
|
||||
const skeletonEl =
|
||||
editorContainer.querySelector(`[data-el-skeleton]`);
|
||||
skeletonEl && skeletonEl.remove();
|
||||
});
|
||||
|
||||
this.el.dispatchEvent(
|
||||
|
@ -42,6 +44,14 @@ const CellEditor = {
|
|||
);
|
||||
},
|
||||
|
||||
disconnected() {
|
||||
// When disconnected, this client is no longer seen by the server
|
||||
// and misses all collaborative changes. On reconnection we want
|
||||
// to clean up and mount a fresh hook, which we force by ensuring
|
||||
// the DOM id doesn't match
|
||||
this.el.removeAttribute("id");
|
||||
},
|
||||
|
||||
destroyed() {
|
||||
if (this.liveEditor) {
|
||||
this.el.dispatchEvent(
|
||||
|
|
Loading…
Add table
Reference in a new issue