Make sure that initial status is drawn correctly

This commit is contained in:
Stephan Egli 2025-01-10 12:04:12 +01:00
parent 2ea5f45eb9
commit 55bf85268a
2 changed files with 6 additions and 3 deletions

View File

@ -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
}

View File

@ -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}) => {