From 5a77c795f224614ba5014d9f31857c66b0be4d2c Mon Sep 17 00:00:00 2001 From: Hebi Li Date: Sun, 13 Aug 2023 10:52:25 -0700 Subject: [PATCH] fix: await bug; rootMap.set typo --- api/src/yjs-blob.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/src/yjs-blob.ts b/api/src/yjs-blob.ts index 22c72214..e31ceb75 100644 --- a/api/src/yjs-blob.ts +++ b/api/src/yjs-blob.ts @@ -132,7 +132,7 @@ async function loadFromDB(ydoc: Y.Doc, repoId: string) { } else { if (repo.pods.length > 0) { // TODO run the migration script seprately. - migrate_v_0_0_1(ydoc, repoId); + await migrate_v_0_0_1(ydoc, repoId); } else { // init the ydoc const rootMap = ydoc.getMap("rootMap"); @@ -151,7 +151,7 @@ export async function bindState(doc: Y.Doc, repoId: string) { // Load persisted document state from the database. await loadFromDB(doc, repoId); // Observe changes and write to the database. - await setupObserversToDB(doc, repoId); + setupObserversToDB(doc, repoId); } export function writeState() { @@ -193,8 +193,8 @@ async function migrate_v_0_0_1(ydoc: Y.Doc, repoId: string) { const edgesMap = new Y.Map(); const codeMap = new Y.Map(); const richMap = new Y.Map(); - rootMap.set("nodesMap", new Y.Map()); - rootMap.set("edgesMap", new Y.Map()); + rootMap.set("nodesMap", nodesMap); + rootMap.set("edgesMap", edgesMap); rootMap.set("codeMap", codeMap); rootMap.set("richMap", richMap); const metaMap = new Y.Map();