Repository navigation
fix(sections-editor): don't mistake a stale read of your own saves for someone else's change - #8000
Merged
Merged
Conversation
…r someone else's change Right after a save commits, a re-read of the draft can still return an older version of the block (the provider answers with the previous head for a few seconds, or a response arrives out of order). The editor took that older copy for another editor's change, merged with the stored version preferred, showed the result, and the retry after the refused save then wrote it back: the user's last edits were reverted, with a "Changed while you were editing" warning naming the field. - The section form remembers every version it started from or saved; a read that returns one of them is treated as an echo, not a change, and the save goes ahead (the server's version check still guards it). - useSaveBlock does the same for its own saves: when the re-read after a refused save returns an older save of this tab, it waits and sends the same edit again instead of merging. - A save refused again is retried with backoff (up to 3 times) before the form reloads, instead of reloading after the second refusal.
decocms Bot
pushed a commit
that referenced
this pull request
Oct 15, 2026
PR: #8000 fix(sections-editor): don't mistake a stale read of your own saves for someone else's change Bump type: patch - decocms (apps/api/package.json): 4.488.13 -> 4.488.14 - @decocms/native (apps/native/package.json): 4.488.13 -> 4.488.14 - @decocms/e2e (packages/e2e/package.json): 1.115.1 -> 1.115.2 Deploy-Scope: web
tlgimenes
added a commit
that referenced
this pull request
Oct 16, 2026
When a save kept another editor's value of the field the user is typing in, the form keeps showing their text until they leave it (05d4ae5), but its baseline stayed the refused copy. Their next keystrokes were merged against that copy again, lost to the stored value with a second toast, and the field went back to the stored value when they left it: the edit was gone. The form's baseline is now the merge it saved, and FormBase.displayed holds what the form shows instead. A field the user changes after the notice is saved over the stored value they were told about; a field they leave alone keeps the stored value; a change from elsewhere after that is still caught by #7909's check. Nothing is ever a mix of both texts. Tests: e2e "typing on after a save kept the other editor's value saves what the user typed, never mixed with that value" (fails before: the stored headline stays "Published headline"); unit tests for formValueOnBase and displayedOverBase. The spec's toast and poll waits allow for main's backoff retry (#8000) under load, and toasts are counted as they appear. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
tlgimenes
added a commit
that referenced
this pull request
Oct 18, 2026
…e can't drop the next edit
Under load the form's autosave could send a second save while a first one
was still on its way. When the first was refused as stale, the second was
built on a copy that never landed: mutate() reported only its outcome, its
starting point was put back to the unsaved first edit, and the replay on
the stored block then counted the user's own edit as a conflict and kept
the stored value. The user's edit was lost and the toast named the wrong
field (seen on a v7 site with two people on one block).
- A section form now has one save on the wire at a time; the next is built
once that one lands or is refused (mutateAsync, so every outcome is
heard). A retry after a refusal reads the form's value when it runs.
- The conflict toast names fields by their label in the form ("Headline",
not "title"), says "The latest version was kept." when nothing else of
the form's was left to save, and every outcome of one change shares one
toast.
- With main's #8000, a refused save is retried with backoff (up to 3
times) before the form reloads; while a retry waits out its backoff the
form's next saves wait behind it, as behind a save on the wire, and the
retry carries the form's latest value.
Tests: e2e "a form that saves again while its refused save is on the wire
keeps both edits" (fails before: the headline goes back to the stored one
with a "Changed while you were editing: headline" toast); the same-field
e2e now expects the label and the shorter copy; unit tests for the labels.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
tlgimenes
added a commit
that referenced
this pull request
Oct 18, 2026
When a save kept another editor's value of the field the user is typing in, the form keeps showing their text until they leave it (05d4ae5), but its baseline stayed the refused copy. Their next keystrokes were merged against that copy again, lost to the stored value with a second toast, and the field went back to the stored value when they left it: the edit was gone. The form's baseline is now the merge it saved, and FormBase.displayed holds what the form shows instead. A field the user changes after the notice is saved over the stored value they were told about; a field they leave alone keeps the stored value; a change from elsewhere after that is still caught by #7909's check. Nothing is ever a mix of both texts. Tests: e2e "typing on after a save kept the other editor's value saves what the user typed, never mixed with that value" (fails before: the stored headline stays "Published headline"); unit tests for formValueOnBase and displayedOverBase. The spec's toast and poll waits allow for main's backoff retry (#8000) under load, and toasts are counted as they appear. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
tlgimenes
added a commit
that referenced
this pull request
Oct 19, 2026
…e into someone else's text (#8027) * fix(web): a skipped preview transition no longer logs an uncaught AbortError Quick successive saves skip the running view transition; its ready and updateCallbackDone promises then reject with "Transition was skipped" and only finished was handled. The swap now settles all three. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * fix(web): a section form saves one change at a time, so a refused save can't drop the next edit Under load the form's autosave could send a second save while a first one was still on its way. When the first was refused as stale, the second was built on a copy that never landed: mutate() reported only its outcome, its starting point was put back to the unsaved first edit, and the replay on the stored block then counted the user's own edit as a conflict and kept the stored value. The user's edit was lost and the toast named the wrong field (seen on a v7 site with two people on one block). - A section form now has one save on the wire at a time; the next is built once that one lands or is refused (mutateAsync, so every outcome is heard). A retry after a refusal reads the form's value when it runs. - The conflict toast names fields by their label in the form ("Headline", not "title"), says "The latest version was kept." when nothing else of the form's was left to save, and every outcome of one change shares one toast. - With main's #8000, a refused save is retried with backoff (up to 3 times) before the form reloads; while a retry waits out its backoff the form's next saves wait behind it, as behind a save on the wire, and the retry carries the form's latest value. Tests: e2e "a form that saves again while its refused save is on the wire keeps both edits" (fails before: the headline goes back to the stored one with a "Changed while you were editing: headline" toast); the same-field e2e now expects the label and the shorter copy; unit tests for the labels. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * fix(web): a merge never swaps a field under the user's cursor Under load the form's autosave fires while the user is still typing. When the save comes back merged and the merge kept another editor's value of the field being typed in, the form showed that value at once, so the next keystrokes landed after it ("Picks A again" + "holk" ...) and the mix was saved as the user's edit, over the other editor's value. The reload after the last retry re-seeded the form under the cursor the same way. While focus is in the open form, those now wait: the form keeps showing what the user types (its saves keep merging onto the stored section, so the field keeps the stored value) and re-reads the stored section once the user leaves the form and its own saves have settled. Merges that kept every edit of the form still show at once. Tests: e2e "typing on after a save kept the other editor's value does not add the keystrokes to that value" (fails before: the field reads "Published headline more"); the same-field e2e checks the stored value after the user leaves the field; unit tests for mergedFormDisplay. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * fix(web): what a user types after "The latest version was kept" is saved When a save kept another editor's value of the field the user is typing in, the form keeps showing their text until they leave it (05d4ae5), but its baseline stayed the refused copy. Their next keystrokes were merged against that copy again, lost to the stored value with a second toast, and the field went back to the stored value when they left it: the edit was gone. The form's baseline is now the merge it saved, and FormBase.displayed holds what the form shows instead. A field the user changes after the notice is saved over the stored value they were told about; a field they leave alone keeps the stored value; a change from elsewhere after that is still caught by #7909's check. Nothing is ever a mix of both texts. Tests: e2e "typing on after a save kept the other editor's value saves what the user typed, never mixed with that value" (fails before: the stored headline stays "Published headline"); unit tests for formValueOnBase and displayedOverBase. The spec's toast and poll waits allow for main's backoff retry (#8000) under load, and toasts are counted as they appear. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * fix(web): typing the same text again after "The latest version was kept" saves it After a save kept another editor's value of the field the user is in, the field still shows the user's text (until they leave the form). A user who insists, selecting it and typing the same text again, ended with the value the form already showed, so nothing counted as changed: the save kept the stored value and the field flipped to it when they left. Every value the user changes after the merge is now marked in FormBase.displayed, so it is theirs even when it ends as it was shown. Values they don't touch still keep the stored value. Tests: e2e "typing the same text again after the latest version was kept saves it" (fails before: the stored headline stays "Published headline"); unit tests for markEditedSinceDisplayed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * test(e2e): stale-form toasts are counted as they appear "a form that saves again while its refused save is on the wire keeps both edits" counted the toasts on screen after a poll of up to 30 s; on a busy machine the toast had already expired (count 0). Toasts are now counted by text as they appear, as in the typing-on test. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * feat(web): a same-field edit conflict asks the user whose version to keep When the user and someone else changed the same values of a section, the form no longer keeps the stored value with a toast and the "on-leave" heuristics. Nothing of the form's is written: its saves wait, and one dialog ("Someone else changed this while you were editing") lists each value by its form label, "Your version" next to "Their version" (a word diff for text, a thumbnail for images, a summary for lists and objects), with "Keep mine" / "Use theirs" per field and "Keep all mine" / "Use all theirs". Apply saves the choice against the stored version the dialog showed (the save's `expect`); a newer one refuses it and the same choice is asked again with that version. "Decide later" keeps their version stored and the user's edits in the form, unsaved, with a "Choose versions" notice. Values only one side changed still merge silently, now item by item within lists. Removed: the "Changed while you were editing" toasts, mergedFormDisplay "on-leave", FormBase.displayed (typing on after the toast saving over theirs). A save's page, page variant and section variant are fixed when it is scheduled, so a choice made after the user moved on still writes there. (Port of 731befa from the v8 stack, without the v8 parts.) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * test(e2e): same-field conflicts go through the choose-versions dialog site-editor-stale-form: keep mine, decide later then use theirs, mixed per-field choices, different fields merge with no dialog, a third change while the dialog is open asks again with the newer version. The hero fixture gains a Subtitle field. (Port of c63ee03 from the v8 stack, without the deco-serve case.) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * test(e2e): find the form behind the conflict dialog with includeHidden The Keep mine case checked the headline after typing into the open dialog with the form's role locator. The dialog is modal, so everything outside it is aria-hidden and the locator found nothing ("element(s) not found", the form showing "Draft headline" behind the dialog in the screenshot). The check now includes hidden elements. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * feat(api): changed-by tells the site editor who made the other change, and when GET /api/:org/decofile/:project/:branch/changed-by?block=<key> (1 to 5 keys, signed-in members only) answers { changedBy: { [key]: { name?, email?, avatarUrl?, at, you? } } } for the "someone else changed this" dialog. The editor asks once per version the dialog shows, never per poll. Nothing new is stored: the block file's latest commit on the draft branch (insights listCommits with a new `path` filter, limit 1: one GitHub call per block) gives the Co-authored-by trailer the commit coalescer appends, else the commit author when it is a person, and the commit time. The identity is mapped to the org member (name, avatar) by email, else the git name; `you` when it is the viewer. Unknown parts are left out. Insights commits now carry the message body (where the trailers are), and insightsClientForProjectRepo opens a project's history client, as on the Blocks v8 line (#7887). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * feat(web): the same-field conflict dialog says who made the other change, and when Under the dialog's title: "Changed by Ana Souza · 3 minutes ago" with the member's avatar and the exact time on hover; "You, in another tab or window · …" for the viewer's own change; "Changed … ago" when only the time is known. No line while it isn't known (never "unknown"). en and pt-BR. A Fast Preview session asks Studio's history (GET …/changed-by) once per version of theirs the dialog shows, never per poll: "Their version changed again" reads who and when again. A sandbox session shows nothing. The conflict remembers the block its save writes (a saved block, else the page). formatRelativeTime comes from the Blocks v8 line (#7888). e2e (written, not run here): stale-form asserts "You, in another tab or window" for the same user's other save and "Changed by Dev Person" after a developer's push while the dialog is open. The GitHub stub gains the GraphQL commit history (as on #7888) with a path filter, commit dates and authors, and an admin push; the API's GraphQL URL points at the stub. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * Revert who/when in the same-field dialog on main This reverts commits 9dcf8fb and 46fe475. PO (final): "only have metadata and changed by on v8 hosted": a v7 (Fast Preview) dialog shows no "changed by" line. The dialog itself stays. Gone with it: the changed-by route, commit trailer/author parsing, insights' path filter and message body, insightsClientForProjectRepo and formatRelativeTime copied for it, the GitHub stub's history and push, and the GraphQL URL in the e2e config. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * fix(web): the conflict dialog reads rich text with the DOM parser, never regex sanitizing CodeQL flagged the tag stripping and entity decoding (incomplete multi-character sanitization, double unescaping). Text now comes from DOMParser's textContent; without a DOM, tags are dropped until none is left and each entity is decoded once. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * feat(web): the same-field dialog must be answered, with yours preselected PO 2026-10-18: "Keep yours" / "Use theirs" wording, and "If the user needs to decide, we need to raise an alert dialog with no close option" (Decide later left the form in a frozen state). Picked: must-decide, yours preselected. - FormConflictDialog is an AlertDialog with no close button; Escape and a click outside don't close it. Only "Save selected versions" does. - Every conflicting field starts on "Keep yours" (defaultConflictChoices); a re-plan (their version changed again) keeps the choices that still hold and puts the rest back on yours. "Use theirs" switches every field. - Removed: Decide later, the "not saved yet / Choose versions" notice, conflictDialogOpen, reviewFormConflict, everyConflictChosen and their strings. One save at a time and the expected-version guard are unchanged. - pt-br: "Manter a sua" / "Usar a deles" / "Salvar versões escolhidas". - Tests: unit (default yours, one click, mixed, switch all, no close affordance); e2e stale-form drops the decide-later case, adds Escape / click outside, default saves yours, Use theirs for every field. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * fix(web): the conflict dialog takes focus when it opens Radix's alert dialog focuses its Cancel button on open; this one has none, so focus stayed in the form behind it and keys typed after the dialog appeared still reached the field (the stale-form e2e caught "Draft headlinexyz"). Focus the dialog itself: typing stops there, and a space typed mid-word can't press a button. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * fix(web): a skipped page-to-page preview transition no longer logs an uncaught AbortError A site that opts into cross-document view transitions (`@view-transition { navigation: auto }`, as the Storefront v7 store does) gets one on every reload a Fast Preview save makes. When the next save navigates the frame before that transition starts, Chrome skips it and rejects the outgoing page's `pageswap` transition `ready` promise with "AbortError: Transition was skipped". Nothing handled it, so the editor's page logged an uncaught error (QA-8027, step 8). The editor script, injected into every preview page on load, now settles the promises of the outgoing page's transition from a `pageswap` listener (registered once per page and kept after deactivate), with the same helper the in-place swap already used. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * fix(web): the open conflict dialog follows their version in place While a same-field dialog was open nothing read the stored blocks again, so "their version" stayed the copy the dialog opened with; a newer save only showed after "Save selected versions" was refused (QA-8027, step 5). While a dialog is open, the editor's own decofile read runs again every 3 s (15 s after two minutes open), one poll however many fields or waiting saves, stopped when the dialog closes. A tick is skipped while a write is on the wire, a read is running or just landed, or the tab is hidden. On Fast Preview the read first asks the branch head conditionally (`If-None-Match`, the same GET): an unchanged branch answers 304, with no body and no new draft grant, so the preview pointer (and frame) stays put. The newer copy goes through the existing render-time re-plan, now `refreshWaitingChoice`: their version in place, "Their version changed again while this was open.", picks kept where both versions are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * test(e2e): the open conflict dialog shows a newer version of theirs with no click Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * fix(web): a Fast Preview frame loads one draft at a time Every save gives the preview a new `?__draft=` pointer, and React set it on the frame at once, even while the frame was still loading the last one. That cancels the load (its render is wasted, so quick saves showed nothing new until they stopped), and on a site with page-to-page view transitions (`@view-transition { navigation: auto }`) the page being left rejects its `pageswap` transition with "AbortError: Transition was skipped". Measured on the kit: the store answered about 0.9 s after a save's navigation, the next save's pointer came 0.5 s later, before the page committed (QA-8027, step 8). The editor script settles that promise where it runs, but a v7 site only runs it for the origins its LiveControls trusts. A Fast Preview pointer that arrives while the frame loads now waits for the frame's load; then the latest goes in, the ones in between skipped. A held navigation whose load never fires is released after 15 s. Other frames (sandbox, Local) follow their src at once, as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * fix(web): the merge toast says both changes were kept "Your changes were applied on top of the latest version" read like an override. When different fields were changed, both edits are kept, so it now says so: "Someone else also edited this block. Both changes were kept." Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * feat(web): the same-field dialog shows two people, two cards The product owner picked "Option B: two people, two cards" ("i like the friendliest option b") for the dialog that asks whose version to keep. One field in conflict, the common case: "Someone else changed the title while you were editing", "Pick the one to keep. The other is discarded." Two whole-card choices, stacked: "You" (your avatar or initials, "Your version · not saved yet") and "Someone else" ("Their version · already saved"), each with its text and the changed words marked. Each card is a radio (arrow keys move the choice). Yours is chosen; the one button names what saving does: "Keep yours" or "Use theirs". Two or more fields: a row per field with its label, a Yours / Theirs switch and that side's value. "Use theirs for all", and a button that names the outcome: "Keep yours", "Keep a mix" or "Use theirs". Unchanged: it must be answered (no close button, Escape or click outside), it follows their newer version in place while open, images, lists and objects keep their previews. Strings the old layout used are removed; pt-br says "o campo “Título”", which reads naturally whatever the label's gender. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * chore(web): applyLabel is not exported Only the dialog uses it (knip). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * feat(web): several conflicting fields are asked one at a time The product owner approved "one field at a time" for a conflict on several fields ("good"), replacing the Yours / Theirs switch per field. Each field gets a step with the same two cards as the single-field dialog, yours chosen: "Someone else also changed the title", "Pick the one to keep. You can go back before saving." A dot per field (a button named by it; the current one wider, the ones moved on from filled) and "1 of 3" above. Next keeps the pick and moves on; Back, a dot or the ←/→ keys revisit a step (not while typing in a text field; on a card, ↑/↓ change the pick). The last step sums up the picks ("Title: yours · Button text: theirs") and its button names the outcome: "Keep yours", "Keep a mix" or "Use theirs". Nothing is saved before that click, and the second click of a double click on Next doesn't count as one. "Use theirs for all" stays on every step: it picks theirs everywhere and goes to the last step, so saving is still one click on "Use theirs". When their version changes again while the dialog is open, the steps show the newer values, the picks that still apply are kept, and the dot of each field whose value changed gets a ring until it is visited (markTheirsChanged counts the changes per field). One field is unchanged: no dots, no Back or Next. The switch layout's code and strings are removed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu * feat(web): the conflict dialog's buttons read Next and OK The product owner asked for plain step buttons: "Remove the 'use theirs for all' button", the primary as "next/next/done", then "instead of done, ok". With several fields, every step but the last shows Next and the last one OK, which saves the picks as "Keep yours" / "Keep a mix" / "Use theirs" did. The single-field dialog's button is OK as well. pt-br: "Próximo" and "OK". "Use theirs for all" is gone from every step, with its strings, unit test and e2e case; so is the label that named the outcome and its strings. Cards, dots, Back, the last step's summary, the arrow keys, the must-decide dialog, the refresh ring, yours preselected and the double-click guard on the last Next are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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?
Since #7918, editors on a large site report that the CMS shows "Changed while you were editing: countdowns. The latest version of those fields was kept, and the rest of your changes were saved." Their last edits then disappear and have to be redone. Nobody else was editing the block.
What happened
I traced it in one draft's push history, a project with about 2,000 blocks. The editor deleted two items from an array, then renamed an item. Two saves later, each of those edits was undone. Each of the reverting commits is byte-for-byte identical to an earlier save of the same editor:
The editor's local copy of the block went back to one of its own earlier versions. Right after a commit, a re-read can still answer with the branch's previous head for a few seconds (provider read-after-write lag, or a response that lands out of order). From there:
Nobody else touched the block in that window. The "conflict" is the editor disagreeing with its own past.
The fix
form-base.ts,sections-editor.tsx). It records every version it started from or saved, up to 50, as canonical JSON. A read that returns one of them is treated as an echo, not as someone else's change: no merge, no warning. The save goes ahead with the base the form actually built on. The server's version check (fix(decofile): stop stale editor copies from reverting other drafts' block changes #7909) still refuses it if the branch really moved on.useSaveBlockdoes the same for its own saves (use-save-block.ts). When the re-read after a refused save returns a version this tab saved, it waits 1.5 s and sends the same edit again instead of merging. This covers page name, path, SEO and matcher saves.sections-editor.tsx). A save refused again is retried up to 3 times (1 s, 2 s, 4 s) before the form reloads. Before, the form reloaded after the second refusal, and while the provider was still catching up that reload could show the older copy.Real conflicts behave as before. A version that is not one of the form's own still goes through the merge and the warning from #7918.
How did you verify your code works?
bun run verify(fmt, oxlint, knip, 11,002 unit tests) andbun run checkpass.form-base.test.ts): own versions include the starting version and every saved one, and key order is ignored.site-editor-stale-form.spec.ts, reproducing the reported sequence:page.route).main: the stored headline ends at "First edit". The second edit is lost.site-editor-stale-form,decofile-api,fast-preview-git-sync,site-editor-breadcrumbs,cms-publish-surface): 34 passed locally.Screenshots/Demonstration
No visual change. The bug was a warning that should not have appeared, followed by lost edits. With the fix, no warning appears in that sequence and the edits stay.
How to Test
Hard to trigger by hand, because it needs the provider to lag right after a commit. The e2e test above stubs exactly that. On a large site:
Migration Notes
None.
Review Checklist
Summary by cubic
Fixes a false conflict in the CMS where a stale re-read of your own saves reverted your edits. Right after a save, the provider could answer with the branch's previous head for a few seconds; the editor treated that older copy as someone else's change, merged it in, and the retry wrote it back, losing your last edits. Now the form and
useSaveBlockkeep a history of versions they started from or saved, treat a read matching one of those as an echo, and retry refused saves with backoff (up to 3 times) before reloading. Real conflicts still go through the existing merge and warning.useSaveBlockwaits 1.5 s and resends the same edit when the re-read after a refused save returns a version this tab saved.Written for commit 9a2481e. Summary will update on new commits.