Skip to content

Delete doc from ydocMap on unmount. Fixes init on re-mount#2637

Merged
fantactuka merged 1 commit intomainfrom
clean-collab-doc-on-unmount
Jul 13, 2022
Merged

Delete doc from ydocMap on unmount. Fixes init on re-mount#2637
fantactuka merged 1 commit intomainfrom
clean-collab-doc-on-unmount

Conversation

@fantactuka
Copy link
Copy Markdown
Collaborator

@fantactuka fantactuka commented Jul 13, 2022

Re-mounting collab editor does not trigger yjs tree update and keeps editor blank. Deleting root ydoc from ydocMap on collab unmount will make sure that re-mount will follow same doc sync process as original mount:

if (doc === undefined) {
doc = new Doc();
yjsDocMap.set(id, doc);
} else {
doc.load();
}

Issue:

Screen_Recording_2022-07-13_at_16.20.30.mov

@vercel
Copy link
Copy Markdown

vercel bot commented Jul 13, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
lexical ✅ Ready (Inspect) Visit Preview Jul 13, 2022 at 1:48PM (UTC)
lexical-playground ✅ Ready (Inspect) Visit Preview Jul 13, 2022 at 1:48PM (UTC)

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 13, 2022
@fantactuka fantactuka marked this pull request as ready for review July 13, 2022 14:03
@fantactuka fantactuka merged commit e70a5ad into main Jul 13, 2022
@fantactuka fantactuka deleted the clean-collab-doc-on-unmount branch July 13, 2022 14:53
@trueadm
Copy link
Copy Markdown
Collaborator

trueadm commented Aug 7, 2022

This change broke nested editors in collaboration. It should only do this if the id is not main?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants