Post

Drafts, publishing and preview

This post is published, and it also has an unpublished draft on top of it — so the Studio has something to publish and the preview flow has something to preview.

A square radial gradient, orange at the centre.

This is the published version of this post. It is what the public site serves.

A draft is a separate row whose id is prefixed with drafts. — exactly as in Sanity. Open this document in the Studio and you will see it has unpublished changes.

Why a separate row rather than a status column

Because a draft is not a state of the published document, it is a different version of it, and both have to exist at once: the site keeps serving what is published while an editor works on what is next. Publishing then becomes one transaction — replace the published row with the draft, delete the draft — rather than a field update that has to be undone if anything downstream fails.

That is also what makes the perspectives meaningful. A query asking for the published perspective never sees the draft row; a query asking for drafts sees the draft overlaid on the published document, so a document with no draft still appears. The public site reads with no session at all, so it cannot ask for anything but published.