We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent da470e9 commit 65f9e98Copy full SHA for 65f9e98
src/utils.js
@@ -239,11 +239,17 @@ const closeConn = (doc, conn) => {
239
Array.from(controlledIds),
240
null
241
);
242
- if (doc.conns.size === 0 && persistence !== null) {
243
- // if persisted, we store state and destroy ydocument
244
- persistence.writeState(doc.name, doc).then(() => {
+ if (doc.conns.size === 0) {
+ // Clean up empty rooms
+ if (persistence !== null) {
245
+ // if persisted, we store state and destroy ydocument
246
+ persistence.writeState(doc.name, doc).then(() => {
247
+ doc.destroy();
248
+ });
249
+ } else {
250
+ // if not persisted, directly destroy the document
251
doc.destroy();
- });
252
+ }
253
docs.delete(doc.name);
254
}
255
0 commit comments