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.
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).
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.