fix: follow a moved draft on tab close, and deploy a followed flow at its new path

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-09-14 16:03:00 +02:00
co-authored by Claude Opus 5
parent 1d09ab4fe5
commit ae6d37fdf8
3 changed files with 7 additions and 5 deletions
@@ -488,9 +488,7 @@
deployedBy = flow.edited_by
// Names the deployed side of the diff. Without it the reader is shown two panes
// and told nothing about what the left one is.
const versions = (flow as any).versions as number[] | undefined
const head = versions?.length ? versions[versions.length - 1] : undefined
deployedLabel = `Deployed${head ? ` v${head}` : ''}${flow.edited_by ? ` by ${flow.edited_by}` : ''}`
deployedLabel = `Deployed${flow.version_id != null ? ` ${flow.version_id}` : ''}${flow.edited_by ? ` by ${flow.edited_by}` : ''} · latest`
}
async function saveFlow(deploymentMsg?: string, toDeploy?: DraftChangesToDeploy): Promise<void> {
+2 -1
View File
@@ -405,7 +405,8 @@ function flushOnPageHide(): void {
body: JSON.stringify({
value: opts.value,
last_sync: opts.force ? undefined : lastSync,
force: opts.force ?? false
force: opts.force ?? false,
id: draftIds.get(key)
}),
keepalive: true
}).catch((e) => {
@@ -379,8 +379,11 @@
// Surface the saved `draft_path` to the Path widget so the topbar shows the
// pending name, not the `draft_{uuid}` URL. Else the widget seeds from the
// URL, the first edit clobbers `draft_path`, and the friendly name is lost.
// Otherwise the URL, set on every load: this route instance is reused when the
// editor follows its draft to a moved item, and the path it opened on is where
// deploy would look for the flow.
const renderedDraftPath = (effectiveFlow as any).draft_path as string | undefined
if (renderedDraftPath) flowInitialPath = renderedDraftPath
flowInitialPath = renderedDraftPath || (page.params.path ?? '')
// "Load another user's draft" handoff: render their value over the deployed
// metadata. Overlay mode (we have our own draft) never saves until the user