Components / cms-merge
Merge after a conflict
Three-way merge when someone saved first: what merged automatically, and theirs, mine or both for each conflict.
With the shadcn CLI
npx shadcn add https://agent-cms-docs.vercel.app/r/cms-merge.jsonWith the agent-cms CLI
npx @mainsoft/agent-cms add cms-mergeThis screen appears inside the editor when someone else saved first. Open the same document in two tabs of the editor demo, save in one, then save in the other. Open the editor demo
Usage#
// Rendered by CmsDocEditor when a save returns conflict_version.
<CmsMerge collection="posts" slug="hello" base={base} baseVersion={3} mine={mine} theirs={current} onSaved={setDoc} onCancel={close} />You rarely mount it yourself: the editor opens it when someone else saved first. Lines that only one side changed merge by themselves; for each overlap you pick theirs, mine or both.
Install#
npx @mainsoft/agent-cms add cms-mergeIt also needs CmsProvider from cms-lib around your admin:
<CmsProvider baseUrl="/api/cms">{children}</CmsProvider>