diff --git a/package.json b/package.json index b491802..072158b 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "yjs": "^13.2.0" }, "peerDependenies": { - "yjs": "^13.0.0" + "yjs": "^13.4.6" }, "optionalDependencies": { "ws": "^7.2.0" diff --git a/src/y-webrtc.js b/src/y-webrtc.js index 1eec6da..aafcab2 100644 --- a/src/y-webrtc.js +++ b/src/y-webrtc.js @@ -582,6 +582,8 @@ export class WebrtcProvider extends Observable { } }) this.connect() + this.destroy = this.destroy.bind(this) + doc.on('destroy', this.destroy) } /** @@ -618,6 +620,7 @@ export class WebrtcProvider extends Observable { } destroy () { + this.doc.off('destroy', this.destroy) // need to wait for key before deleting room this.key.then(() => { /** @type {Room} */ (this.room).destroy()