fix: preserve PDS-side fields (e.g. bskyPostRef) on document update 1b1b4136
`updateDocument` previously built a fresh record from frontmatter only and called `putRecord`, silently dropping any PDS-side fields such as `bskyPostRef`. This broke the `<sequoia-comments>` 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
Russ T Fugal · 2026-02-21 17:01 1 file(s) · +9 −0
packages/cli/src/lib/atproto.ts +9 −0
328 328
		textContent = stripMarkdownForText(post.content);
329 329
	}
330 330
331 +
	// Fetch existing record to preserve PDS-side fields (e.g. bskyPostRef)
332 +
	const existingResponse = await agent.com.atproto.repo.getRecord({
333 +
		repo: agent.did!,
334 +
		collection: collection!,
335 +
		rkey: rkey!,
336 +
	});
337 +
	const existingRecord = existingResponse.data.value as Record<string, unknown>;
338 +
331 339
	const record: Record<string, unknown> = {
340 +
		...existingRecord,
332 341
		$type: "site.standard.document",
333 342
		title: post.frontmatter.title,
334 343
		site: config.publicationUri,