mirror of
https://github.com/cudr/slate-collaborative.git
synced 2024-10-27 20:34:06 +00:00
Fix destory (#48)
* Fix destory * In case disconnect when the doc is not loaded
This commit is contained in:
parent
24dca9a49c
commit
d141da4430
@ -149,6 +149,10 @@ export const AutomergeEditor = {
|
|||||||
garbageCursor: (e: AutomergeEditor, docId: string) => {
|
garbageCursor: (e: AutomergeEditor, docId: string) => {
|
||||||
const doc = e.docSet.getDoc(docId)
|
const doc = e.docSet.getDoc(docId)
|
||||||
|
|
||||||
|
if (!doc) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const changed = Automerge.change<SyncDoc>(doc, (d: any) => {
|
const changed = Automerge.change<SyncDoc>(doc, (d: any) => {
|
||||||
delete d.cursors
|
delete d.cursors
|
||||||
})
|
})
|
||||||
|
@ -122,6 +122,8 @@ const withSocketIO = <T extends AutomergeEditor>(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
e.destroy = () => {
|
e.destroy = () => {
|
||||||
|
e.socket.removeListener('disconnect')
|
||||||
|
|
||||||
e.socket.close()
|
e.socket.close()
|
||||||
|
|
||||||
e.closeConnection()
|
e.closeConnection()
|
||||||
|
Loading…
Reference in New Issue
Block a user