Skip to content

fix: await bug; rootMap.set typo #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions api/src/yjs-blob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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() {
Expand Down Expand Up @@ -193,8 +193,8 @@ async function migrate_v_0_0_1(ydoc: Y.Doc, repoId: string) {
const edgesMap = new Y.Map<ReactflowEdge>();
const codeMap = new Y.Map<Y.Text>();
const richMap = new Y.Map<Y.XmlFragment>();
rootMap.set("nodesMap", new Y.Map<ReactflowNode>());
rootMap.set("edgesMap", new Y.Map<ReactflowEdge>());
rootMap.set("nodesMap", nodesMap);
rootMap.set("edgesMap", edgesMap);
rootMap.set("codeMap", codeMap);
rootMap.set("richMap", richMap);
const metaMap = new Y.Map();
Expand Down