fix: taking the latest moves the head each editor knows, not just the base

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-09-15 08:47:47 +02:00
co-authored by Claude Opus 5
parent a4da7d3ee6
commit 194c3218d8
3 changed files with 7 additions and 0 deletions
@@ -641,6 +641,8 @@
parentVersion = head
if (deployedBaseline) deployedBaseline = { ...deployedBaseline, parent_version: head }
draftBaseVersion = String(head)
// See /scripts/edit: the head this page knows moves with the base.
deployedHeadVersion = String(head)
// Persisted explicitly, as the script and flow routes do: the reactive
// bundle mirror is parked while auto-save is off, and a parked write is
// dropped on pagehide, so the new base would not survive a reload.
@@ -558,6 +558,8 @@
if (!draftSync.draft || head == null || !$workspaceStore) return
draftSync.draft = { ...draftSync.draft, version_id: head }
draftBaseVersion = String(head)
// See /scripts/edit: the head this page knows moves with the base.
version = head
await UserDraft.forcePersist('flow', flowDraftPath, { workspace: $workspaceStore })
}
: undefined}
@@ -543,6 +543,9 @@
// compares equal and the autosave can discard it.
if (deployedBaseline) deployedBaseline = { ...deployedBaseline, parent_hash: head }
draftBaseHash = head
// The head this page knows moves with it, or the prompt reopens comparing
// the fresh base against the stale head, the two the wrong way round.
deployedHeadHash = head
await UserDraft.forcePersist('script', draftPath, { workspace: $workspaceStore })
}
: undefined}