[RFC] Branching #13981
tylandavis
started this conversation in
Feature Requests & Ideas
[RFC] Branching
#13981
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Background
Payload has draft / published states as well as a full version history for any given document, but sometimes you might need multiple parallels tracks for content, which can span across multiple documents at the same time.
For example, let's say you are building a CMS for a large flower shop.
You might want to prepare multiple campaigns which will update your website and native app, in parallel:
You want to begin working on this year's Valentine's Day campaign in October, well in advance. This year is going to be a big one. But your website is set up for Halloween currently, and you have a bunch of draft content staged for the Christmas campaign that you don't want to lose!
Once Halloween is over, all you'd need to do is merge your Christmas branch with the main branch - then everything's live!
And after Christmas, the same thing is possible - continue to have your editors tweak the Valentine's branch, getting it looking perfectly. Once it's done, just merge the Valentine's branch and everything goes live!
How it would work
Right now, for all version-enabled collections in Payload, we maintain two "tables". The first is the main document table, and one is a _versions table.
The main document table would be unchanged from this work and reflect the main branch. But the _versions table would get some updates.
A new branch property
Building on Payload's existing _versions table, we could augment each saved version with a new branch property, which would track which branch a given version is associated to. Then, as you're browsing the admin UI or fetching content via APIs, you could specify which branch you'd like to retrieve content from. If you do not specify a branch, you'll get back main content (how it works now). But if you specify a branch, then we'll only look for versions of that matching branch name.
A new merge view
Editors will need a way to view all changes from branch to branch in one place as they merge. They should be able to collapse certain documents, leave feedback on certain changes, etc. - all in a newly designed and built view within Payload.
An expanded versions diff view
In Payload's existing Versions Diff view, editors will want to be able to easily compare changes between versions on different branches. We will want to design UX shortcuts that allow editors to accomplish this.
Possible config implementation
Open questions
Tracking changes over time
Do we need a "background" collection to track all create, update, and delete changes made to branches? This collection could store metadata of changes such as a timestamp, an ID of the version / parent doc, and similar. This might improve the queries needed to be made while producing a "diff" view or similar. But it could be duplicative, because we might be able to infer this level of detail as it is now, solely from querying the _versions tables.
This background collection might be necessary in order to store additional information such as:
We'd love to hear your thoughts, comments, and questions about this feature!
Beta Was this translation helpful? Give feedback.
All reactions