Index
Edit

Drafts

When you create a new document a draft is created. A draft document does not appear on the APIs to unauthenticated users and you may not refer to it as a reference before it is published.

When you publish a document it becomes available on the APIs and you may reference it from other documents.

If you keep on working on a published document a new draft gets created and you can reset it back to the document you published document from the context menu.

Behind the sceens

Drafts are saved in a document with an id `drafts.`. This is automatically read protected given . When you publish a document it is copied from the draft into a document without the `drafts.`-prefix (e.g. `drafts.ca307fc7-4413-42dc-8e38-2ee09ab6fb3d` vs `ca307fc7-4413-42dc-8e38-2ee09ab6fb3d`). When you keep working a new draft is created and kept read protected in the drafts document until you publish again.

We're doing it live

Sometimes you might not need drafts at all. Say you're using listeners to update a ranking list in an app and you just want the changes in the studio to go out in real-time on the wire as mutations as the order is being changed.

To disable drafts for a data type simply include liveEdit: true in the schema definition:

export default {
  name: 'author',
  title: 'Author',
  type: 'document',
  liveEdit: true,
  …
  

Previous: ValidationNext: Example Plugins