Repository navigation
fix(sections-editor): keep stored values on real conflicts and follow moved sections - #7918
Merged
Merged
Conversation
… moved sections The editor merged a stale form into the stored section with the form winning every value both had changed, and could splice two sections together when one was inserted above the open one. Make the merge conflict-aware: - Edits to different values still merge silently. - A value both changed keeps the stored version; the rest of the edit is saved and a warning names the fields that kept the stored value. - When a section was inserted, removed, or moved above the open one, the form follows it to its new position and saves there; when the section at the form's position is a different type, the form reloads instead of merging. - Saves built from the cache (page name/path/SEO, matchers, ...) that the server refuses as stale are replayed once on the fresh copy when the two edits touched different values, instead of failing. mergeBlockJson takes the side to prefer and reports conflicting paths; the draft sync keeps preferring the draft.
Following "the section the form opened, found unchanged elsewhere" misfired on pages that repeat a section verbatim: when someone edited the open one in place, its untouched twin matched, and the form's edit was written to the twin. Only look for a moved section when the page gained or lost sections, accept a single match, and reload the form when the match is ambiguous.
viktormarinho
enabled auto-merge (squash)
October 14, 2026 17:55
decocms Bot
pushed a commit
that referenced
this pull request
Oct 14, 2026
PR: #7918 fix(sections-editor): keep stored values on real conflicts and follow moved sections Bump type: patch - decocms (apps/api/package.json): 4.482.3 -> 4.482.4 - @decocms/native (apps/native/package.json): 4.482.3 -> 4.482.4 - @decocms/e2e (packages/e2e/package.json): 1.110.2 -> 1.110.3 - @decocms/shared (packages/shared/package.json): 0.156.1 -> 0.156.2 Deploy-Scope: web
3 of 4 tasks
tlgimenes
added a commit
that referenced
this pull request
Oct 15, 2026
…ection Brings in fold/v8-api, which now carries origin/main (114 commits), including #7909 and #7918 (section forms start from a known version, saves send `expect`, a stale save is refused with 409 and replayed or reloaded). Conflicts resolved: - use-save-block.ts: main's Fast Preview save (`base` -> `expect`, rebase on 409, BlockConflictError, no rollback on a conflict, `written`) moves into this branch's `writeLegacy`; the content-protocol path and SaveGuard stay as they were. `mutate`/`mutateAsync` keep main's `withBase` default and the hook keeps `reportError`. - sections-editor.tsx: both form reloads stay (the content-epoch reload for discards/publishes and #7909's `reloadStaleForm`); main's form-base tracking, three-way merge, section following and retry-once are kept; failed saves use this branch's `reportError`. - serve-save-error.ts: a BlockConflictError's own message (#7909's copy) is the toast headline on every backend, with no Details line. - resolve-schema.ts and its cache test: #7899/#7903 were already cherry-picked here; this branch's lazy-block handling and A9 test stay. - cms-header-actions.tsx / cms-panel-state.ts: main dropped cmsHeaderButtonLabels; the hosted header helpers stay. - playwright.config.ts: both env additions (hosted env, GraphQL stub URL, BOARD_TRANSITION_SETTLE_SECONDS). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
Merged
3 of 4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this contribution about?
Follow-up to #7909. That PR stopped a stale section form from silently reverting changes published from another draft: when the stored section moved on, the editor merges the form's edits on top of it. The merge it uses in the editor still has three cases where the result surprises the user. This PR fixes them, plus one place that still failed outright.
What was still wrong
The fix
mergeBlockJsonin@decocms/shared/decofile): the merge now takes the side to prefer and reports the JSON pointer of every value both sides changed. The draft sync keeps preferring the draft, so its behaviour is unchanged.sections-editor.tsx,form-base.ts):use-save-block.ts): a save built from the cache that the server refuses is replayed once on the fresh copy, when the two edits touched different values. On a real conflict it still fails, and the message now names the fields. The section form opts out withrebaseOnConflict: falsebecause it resolves conflicts itself.Why prefer the stored value in the editor
This matches what the previous admin did within one environment: its JSON Patch
testoperations refused a change to a value someone else had changed. The difference is that the previous admin then discarded the whole edit; here only the conflicting fields keep the stored value, and the rest is saved. Between drafts, the draft still wins per value (unchanged from #7909). A warning at publish time about what will be overwritten is left for a separate PR, because it needs UI in the publish dialog.How did you verify your code works?
bun run verify(fmt, oxlint, knip, 10,933 unit tests) andbun run checkpass.block-merge.test.ts: no conflicts reported for disjoint edits, pointer paths (including escaping),prefer: "theirs"keeping the stored value and the rest of the edit, whole-array conflict.form-base.test.ts:sectionTypeChanged,findSectionMovedTo.conflict-fields.test.ts: readable field names, 1-based positions, truncation.site-editor-stale-form.spec.ts, run locally against the GitHub stub:[409, 200]), and both changes are stored with no error toast.main's editor code and pass with this change.site-editor-stale-form,decofile-api,fast-preview-git-sync,site-editor-breadcrumbs,cms-publish-surface): 33 passed locally.Screenshots/Demonstration
A value someone else also changed keeps the stored version, and the warning names it:
How to Test
Migration Notes
None.
Review Checklist