Flow delete offers to delete its runs, history included

DELETE /runs?flow= removes every Run row of the flow but left its flow_run
rows, so a deleted flow kept appearing in the history. history=true now
drops those too, and the flow delete dialogs (editor and bulk) send it when
"Also delete its runs" is ticked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WgBfkm4rCmtd1T4vHWjEPx
This commit is contained in:
2026-10-15 10:52:33 +02:00
co-authored by Claude Opus 5.5
parent 3c9aec0982
commit 6b0c4a4308
11 changed files with 124 additions and 18 deletions
+9 -2
View File
@@ -31,6 +31,7 @@ import {
FlowsService,
type MessageSpec,
type NodeDef_Input,
RunsService,
} from "@/client"
import { DiscardDraftDialog } from "@/components/Common/Dock"
import { useTheme } from "@/components/theme-provider"
@@ -790,7 +791,13 @@ function FlowEditorInner({
})
const deleteMutation = useMutation({
mutationFn: () => FlowsService.deleteFlow({ name: flowName }),
mutationFn: async (withRuns: boolean) => {
await FlowsService.deleteFlow({ name: flowName })
// After the flow, which is refused while a run is live, so a refusal
// leaves both standing.
if (withRuns)
await RunsService.deleteRuns({ flow: flowName, history: true })
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: flowKeys.all })
setFlowPanelOpen(false)
@@ -1327,7 +1334,7 @@ function FlowEditorInner({
nodeCount={definitions.length}
// Confirmed, so it is a finished edit rather than a run of keystrokes.
onChange={(next) => commitDoc({ ...next, nodes: definitions }, true)}
onDelete={() => deleteMutation.mutate()}
onDelete={(withRuns) => deleteMutation.mutate(withRuns)}
enabled={detail.enabled ?? true}
toggling={enableMutation.isPending}
onToggleEnabled={(next) => enableMutation.mutate(next)}