Think is something that is missing on Cockpit when comparing with other headless solutions, the possibility to define a status on the contents and therefore affect the api calls. Resuming, let’s imagine we want to work on a post that is already visible in live (Published state) and we want to save our changes but without having them visible. So using the addon we can save as a Draft and the API will still return the previous published version.
The Addon provides a new field type (Moderation) that enhances the collection form page with a new option:
More details on the project repo:
During the implementation I faced two challenges:
- Get the latest revision that have a field with a specific value, I’m hooking into the collections.filter.after and if the field is present and value is draft, I load the revisions and iterate until find the correct one. It works well, but not sure if it can cause performance troubles.