Skip to content

Commit 71ec919

Browse files
committed
debug: [FN-350] 증분값 적용 전후 로그 추가
1 parent dbdb6f6 commit 71ec919

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/shared/socket/yjs-provider.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,17 @@ export class YjsProvider {
188188
updateBinary = new Uint8Array(parsed.update);
189189
}
190190

191-
console.log("증분값 적용 전, ", this.doc.getArray("cards"));
191+
const logCards = (label: string) => {
192+
const arr = this.doc.getArray("cards");
193+
const cards = arr.map((cardMap: Y.Map<any>) => ({
194+
id: cardMap.get("id"),
195+
question: cardMap.get("question")?.toString(),
196+
answer: cardMap.get("answer")?.toString(),
197+
}));
198+
console.log(label, cards);
199+
};
200+
201+
logCards("증분값 적용 전");
192202

193203
Y.applyUpdate(this.doc, updateBinary, this);
194204

@@ -199,7 +209,7 @@ export class YjsProvider {
199209
}
200210
}
201211

202-
console.log("증분값 적용 후, ", this.doc.getArray("cards"));
212+
logCards("증분값 적용 후");
203213
});
204214

205215
// Awareness 메시지 처리

0 commit comments

Comments
 (0)