From 1b1b413616fddc0334cd7a4ec15d8f4af012c152 Mon Sep 17 00:00:00 2001 From: Russ T Fugal <128427608+SARAsBooks@users.noreply.github.com> Date: Sat, 21 Feb 2026 17:01:18 -0700 Subject: [PATCH] fix: preserve PDS-side fields (e.g. bskyPostRef) on document update `updateDocument` previously built a fresh record from frontmatter only and called `putRecord`, silently dropping any PDS-side fields such as `bskyPostRef`. This broke the `` web component after the first re-publish. Fix: fetch the existing record with `getRecord` before writing, spread its fields into the new record, then overwrite with the fresh frontmatter-derived values. This preserves all PDS-side fields while still updating the document content correctly. Fixes stevedylandev/sequoia#5 --- packages/cli/src/lib/atproto.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/cli/src/lib/atproto.ts b/packages/cli/src/lib/atproto.ts index af66579..3ceefdd 100644 --- a/packages/cli/src/lib/atproto.ts +++ b/packages/cli/src/lib/atproto.ts @@ -328,7 +328,16 @@ export async function updateDocument( textContent = stripMarkdownForText(post.content); } + // Fetch existing record to preserve PDS-side fields (e.g. bskyPostRef) + const existingResponse = await agent.com.atproto.repo.getRecord({ + repo: agent.did!, + collection: collection!, + rkey: rkey!, + }); + const existingRecord = existingResponse.data.value as Record; + const record: Record = { + ...existingRecord, $type: "site.standard.document", title: post.frontmatter.title, site: config.publicationUri, -- 2.51.2