Drafts & publishing
The Pages collection has Payload's built-in drafts enabled (versions.drafts) - not a custom versioning system.
- Editing autosaves progress as a draft (debounced, via Puck's
onChange) - this never touches the published/live page. - Clicking Publish in the Puck editor (
onPublish) promotes the current changes to_status: "published"- only then does the public route show them. - Reopening the editor loads the latest draft (falling back to published if there is no newer draft), so in-progress edits are never lost.
Why this needed explicit access control
Payload's draft parameter on find/findByID controls which version is returned when you ask for it - it does not filter out documents whose _status is "draft" from a normal query. The public render route explicitly filters where: { _status: { equals: "published" } }, and the Pages collection's access.read enforces the same rule for anyone using the REST/GraphQL API directly (the Local API used by this app's own routes bypasses access control by default, so both guards matter).