fix(pipelines): Save all deploys the open pane's live buffer, not the stale draft snapshot

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-07-07 17:10:10 +00:00
co-authored by Claude Fable 5
parent 3bfb3cca10
commit f1392434b6
@@ -654,7 +654,22 @@
if (!$workspaceStore || pe.drafts.size === 0 || savingAll) return
savingAll = true
const ws = $workspaceStore
const entries = [...pe.drafts.entries()]
// The open pane's keystrokes live in `pe.liveContent` until the pane is
// torn down — the drafts Map still holds the pre-edit snapshot. Deploy
// what the user sees: fold the live buffer into its draft (same merge
// the autosave bundle applies before persisting).
const liveContentPath =
pe.liveContent.scriptPath != undefined && pe.drafts.has(pe.liveContent.scriptPath)
? pe.liveContent.scriptPath
: undefined
const entries = [...pe.drafts.entries()].map(([path, d]) => {
if (path !== liveContentPath || d.script.content === pe.liveContent.content)
return [path, d] as [string, Draft]
return [path, { ...d, script: { ...d.script, content: pe.liveContent.content } }] as [
string,
Draft
]
})
// Snapshot what the preview promises for every draft before anything
// deploys — used to verify the persisted graph below.
const predicted = predictCascadeFacts(entries.map(([p]) => p))