diff --git a/frontend/src/routes/(root)/(logged)/pipeline/[folder]/+page.svelte b/frontend/src/routes/(root)/(logged)/pipeline/[folder]/+page.svelte index cc8c7d5722..fc75d1ed9f 100644 --- a/frontend/src/routes/(root)/(logged)/pipeline/[folder]/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/pipeline/[folder]/+page.svelte @@ -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))