From ae6d37fdf840c3d462748a87c83c826ab3ef4fa8 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Mon, 14 Sep 2026 16:03:00 +0200 Subject: [PATCH] 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) --- frontend/src/lib/components/FlowBuilder.svelte | 4 +--- frontend/src/lib/userDraftDbSyncer.svelte.ts | 3 ++- .../routes/(root)/(logged)/flows/edit/[...path]/+page.svelte | 5 ++++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/src/lib/components/FlowBuilder.svelte b/frontend/src/lib/components/FlowBuilder.svelte index eb1e228f77..eccdbefff4 100644 --- a/frontend/src/lib/components/FlowBuilder.svelte +++ b/frontend/src/lib/components/FlowBuilder.svelte @@ -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 { diff --git a/frontend/src/lib/userDraftDbSyncer.svelte.ts b/frontend/src/lib/userDraftDbSyncer.svelte.ts index a7e3bf6297..37c6a58ed0 100644 --- a/frontend/src/lib/userDraftDbSyncer.svelte.ts +++ b/frontend/src/lib/userDraftDbSyncer.svelte.ts @@ -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) => { diff --git a/frontend/src/routes/(root)/(logged)/flows/edit/[...path]/+page.svelte b/frontend/src/routes/(root)/(logged)/flows/edit/[...path]/+page.svelte index df6f945063..7af95a54e8 100644 --- a/frontend/src/routes/(root)/(logged)/flows/edit/[...path]/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/flows/edit/[...path]/+page.svelte @@ -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