Skip to content

Commit

Permalink
feat: allow empty root id
Browse files Browse the repository at this point in the history
  • Loading branch information
darkskygit committed Sep 12, 2024
1 parent 8e4dcdc commit e6a7f02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions y-octo-node/src/doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class Doc extends Y.Doc {
new Set();
private lastState: Buffer | null = null;

getArray(key: string): Array {
getArray(key = ""): Array {
if (this.cachedArray.has(key)) {
return this.cachedArray.get(key)!;
}
Expand All @@ -19,7 +19,7 @@ export class Doc extends Y.Doc {
return yarray;
}

getMap(key: string): Map {
getMap(key = ""): Map {
if (this.cachedMap.has(key)) {
return this.cachedMap.get(key)!;
}
Expand All @@ -28,7 +28,7 @@ export class Doc extends Y.Doc {
return ymap;
}

getText(key: string): Text {
getText(key = ""): Text {
return this.getOrCreateText(key);
}

Expand Down
2 changes: 1 addition & 1 deletion y-octo-node/tests/yjs/doc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ test("testClientIdDuplicateChange", (t) => {
t.assert(doc2.clientId !== doc1.clientId);
});

test.skip("testGetTypeEmptyId", (t) => {
test("testGetTypeEmptyId", (t) => {
const doc1 = new Y.Doc();
doc1.getText("").insert(0, "h");
doc1.getText().insert(1, "i");
Expand Down

0 comments on commit e6a7f02

Please sign in to comment.