Skip to content

Commit e6a7f02

Browse files
committed
feat: allow empty root id
1 parent 8e4dcdc commit e6a7f02

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

y-octo-node/src/doc.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class Doc extends Y.Doc {
1010
new Set();
1111
private lastState: Buffer | null = null;
1212

13-
getArray(key: string): Array {
13+
getArray(key = ""): Array {
1414
if (this.cachedArray.has(key)) {
1515
return this.cachedArray.get(key)!;
1616
}
@@ -19,7 +19,7 @@ export class Doc extends Y.Doc {
1919
return yarray;
2020
}
2121

22-
getMap(key: string): Map {
22+
getMap(key = ""): Map {
2323
if (this.cachedMap.has(key)) {
2424
return this.cachedMap.get(key)!;
2525
}
@@ -28,7 +28,7 @@ export class Doc extends Y.Doc {
2828
return ymap;
2929
}
3030

31-
getText(key: string): Text {
31+
getText(key = ""): Text {
3232
return this.getOrCreateText(key);
3333
}
3434

y-octo-node/tests/yjs/doc.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ test("testClientIdDuplicateChange", (t) => {
5050
t.assert(doc2.clientId !== doc1.clientId);
5151
});
5252

53-
test.skip("testGetTypeEmptyId", (t) => {
53+
test("testGetTypeEmptyId", (t) => {
5454
const doc1 = new Y.Doc();
5555
doc1.getText("").insert(0, "h");
5656
doc1.getText().insert(1, "i");

0 commit comments

Comments
 (0)