fall back to createFlow when the update target does not exist (#10206)

FlowBuilder's deploy branches solely on the `newFlow` prop. When an embedder
mounts the builder with `newFlow` false for a flow that was never deployed,
Deploy issues `PUT /flows/update/{initialPath}` and the backend answers
`Flow not found at name <path>`, so the first deploy can never land.

Confirm against `GET /flows/exists/{path}` before taking the update branch,
and create instead when nothing is deployed there. The create path and the
full-page editor (where `newFlow` is derived from `no_deployed`) are
unchanged.

Fixes WIN-2206

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-07-20 13:10:26 +02:00
committed by GitHub
co-authored by Claude Opus 4.8
parent 71f2d47cb4
commit 4f1d636005
+16 -1
View File
@@ -413,7 +413,22 @@
// loadingSave = false // del
// return
if (newFlow) {
// `newFlow` comes from the embedder, and updating a path that has no
// deployed flow 404s. Confirm with the server before taking the update
// branch so a first deploy still lands.
let isNewFlow = newFlow
if (!isNewFlow) {
try {
isNewFlow =
initialPath === '' ||
!(await FlowService.existsFlowByPath({ workspace: opWorkspace!, path: initialPath }))
} catch (err) {
// Unreachable check: keep the caller's intent rather than failing the deploy.
console.error('Could not check flow existence', err)
}
}
if (isNewFlow) {
await FlowService.createFlow({
workspace: opWorkspace!,
requestBody: {