Просмотр исходного кода

Revert " cleanup"

This reverts commit a2707680d0634d0a0dc5548e5ecc157c53976e60.
Shun Miyazawa 1 год назад
Родитель
Сommit
31b079b7d9

+ 3 - 0
apps/app/src/server/service/page/index.ts

@@ -4460,8 +4460,11 @@ class PageService implements IPageService {
 
 
   async syncLatestRevisionBodyToYjsDraft(pageId: string): Promise<void> {
   async syncLatestRevisionBodyToYjsDraft(pageId: string): Promise<void> {
     const yjsConnectionManager = getYjsConnectionManager();
     const yjsConnectionManager = getYjsConnectionManager();
+    // await yjsConnectionManager.mdbInstance.clearDocument(pageId);
+
     const Revision = mongoose.model<IRevisionHasId>('Revision');
     const Revision = mongoose.model<IRevisionHasId>('Revision');
     const revision = await Revision.findOne({ pageId }).sort({ createdAt: -1 });
     const revision = await Revision.findOne({ pageId }).sort({ createdAt: -1 });
+
     if (revision != null) {
     if (revision != null) {
       await yjsConnectionManager.handleYDocUpdate(pageId, revision.body);
       await yjsConnectionManager.handleYDocUpdate(pageId, revision.body);
     }
     }

+ 1 - 1
apps/app/src/server/service/yjs-connection-manager.ts

@@ -68,7 +68,7 @@ class YjsConnectionManager {
       currentYdoc.getText('codemirror').insert(0, initialValue);
       currentYdoc.getText('codemirror').insert(0, initialValue);
     }
     }
 
 
-    await this.syncWithPersistedYdoc(pageId, currentYdoc, persistedYdoc);
+    this.syncWithPersistedYdoc(pageId, currentYdoc, persistedYdoc);
 
 
     currentYdoc.on('update', async(update) => {
     currentYdoc.on('update', async(update) => {
       await this.mdb.storeUpdate(pageId, update);
       await this.mdb.storeUpdate(pageId, update);