From 55bf85268a6002b1bbbc41e673f15b6b103963b8 Mon Sep 17 00:00:00 2001 From: Stephan Egli Date: Fri, 10 Jan 2025 12:04:12 +0100 Subject: [PATCH] Make sure that initial status is drawn correctly --- src/docManager.js | 6 +++--- src/main.js | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/docManager.js b/src/docManager.js index f3b3e9b..39db27c 100644 --- a/src/docManager.js +++ b/src/docManager.js @@ -30,9 +30,9 @@ export function initRepo() { document.location.hash = handle.url } - handle.on("change", ({doc}) => { - console.log("Document changed!", doc) - }) + // handle.on("change", ({doc}) => { + // console.log("Document changed!", doc) + // }) return handle } diff --git a/src/main.js b/src/main.js index 9790da2..8f8be49 100644 --- a/src/main.js +++ b/src/main.js @@ -13,6 +13,9 @@ const canvas = document.getElementById("shapesCanvas") const handle = initRepo() await handle.whenReady() +// draw current state +drawAllShapesOnCanvas(canvas, handle.docSync().shapes) + // 2. Subscribe so we can re-render whenever doc changes // Listen for 'change' events handle.on("change", ({doc}) => {