What side effects should I expect if I enable "draft/published" on an existing model with existing content items?

We have some models that we originally created without the draft/published system enabled. Those models have existing content items which our application expects to exist.

We want to change those models to enable the draft/published system. What side effects should we expect to see?

For example:

  • Will the existing content items remain (or implicitly become) “published”?

  • Will those existing content items still be returned via the GraphQL API? That’s how our app retrieves all of the content items for all of our models.

  • Will webhooks associated with those models be triggered? They’re currently set up to be triggered only on “create”.

  • Any other considerations we should take into account?

Our goal is to not have to make any application changes. But if we do have to make such changes, we want to know that before we enabled draft/published in our primary environment.

Thanks.

Hi @donnie.hale,

  • Will the existing content items remain (or implicitly become) “published”?

When you don’t have the draft/pub system enabled on a model, its records are implicitly published as soon as you click “Save”. You can verify this with a webhook set to both Create and Publish, using something like requestcatcher.com (or your own endpoint).

Also in GraphQL:

You can see those posts have a published status and time, even though their model doesn’t have the draft/pub system enabled:


  • Will those existing content items still be returned via the GraphQL API? That’s how our app retrieves all of the content items for all of our models.

Yes.

After enabling that, existing records remain published. Then if you add a new record, save it (but not publish it), you can only see it in the drafts if you send a preview header:

The other posts (from before draft/pub was turned on) remain published and available as before.


  • Will webhooks associated with those models be triggered? They’re currently set up to be triggered only on “create”.

Depends on what that webhook is supposed to do. If you want it to build a page only when a record is ready & published, it should be switched to “Publish” instead of “Create”. If it’s to run tests, build previews, etc., as soon as a draft is saved, then it can be on “Create”.

To be clearer:

When draft/published is disabled:

  • Creating a record in the UI and typing in it doesn’t fire any webhooks yet
  • As soon as you save that new record, the Create and Publish webhooks fire at the same time
  • When you edit that record and save it again, the Update and Publish webhooks fire at the same time

But when draft/published is ENABLED:

  • Creating a record in the UI and typing in it still won’t fire any webhooks at first
  • Once you save, the Create event is fired. The record is in a draft state and can only be retrieved in preview mode.
  • Once you click publish, the Publish event is fired and the record is now publicly available.
  • Once you update and save again, the Update event is fired. The previously published version remains accessible to the public, and the newly updated version can only be seen in draft mode.
  • Once you click publish again, the Publish event is fired. The published version is replaced by the draft.

Any other considerations we should take into account?

In general, if your site is complex enough and you don’t want to risk any accidental breakage and downtime, we’d encourage you to use sandbox environments to test changes on a dev/stage branch instead. Then when everything looks good, you can promote the sandbox to primary.

That should allow safe, non-destructive testing (and easier rollbacks) than just flipping switches on primary.

Hope that helps!