From 1ed7ed7460b4964bd6ced93f4b29111e653f0233 Mon Sep 17 00:00:00 2001 From: yousefed Date: Fri, 9 Oct 2026 10:34:40 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(dev-instance)=20store=20the=20samp?= =?UTF-8?q?le=20content=20only=20once?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The import tested for an empty document with the last clock of yhub, but the last clock stays 0 after the row the import writes itself. So every deploy stored the content of the sample document again. The import now looks for stored updates instead. Signed-off-by: yousefed --- deploy/dev-instance/seed/import.mjs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/deploy/dev-instance/seed/import.mjs b/deploy/dev-instance/seed/import.mjs index 9c1e72a9c6..92e54c5dae 100644 --- a/deploy/dev-instance/seed/import.mjs +++ b/deploy/dev-instance/seed/import.mjs @@ -14,10 +14,11 @@ const history = decodeAny(new Uint8Array(fs.readFileSync(process.argv[2]))); const docRef = { org: history.org, docid: history.docid, branch: 'main' }; const persistence = await createPersistence(process.env.POSTGRES, []); -// Only an empty document gets the content: a second clock-0 row would -// attribute the same content twice. -const current = await persistence.retrieveDoc(docRef, {}); -if (current.lastClock === '0') { +// Only an empty document gets the content: a second row would attribute the +// same content twice. `lastClock` cannot tell, it stays '0' after the clock-0 +// row this import writes, so look for stored updates instead. +const current = await persistence.retrieveDoc(docRef, { gc: true }); +if (current.gcDoc.length === 0 && current.lastClock === '0') { await persistence.store(docRef, { lastClock: '0', gcDoc: history.gcDoc,