fix: swallow 404 in checkFlowOnBehalfOf so renaming a flow doesn't toast

This commit is contained in:
Guilhem Lemouel
2026-05-06 12:34:47 +02:00
parent 0ed99d8484
commit 82dec462ae
@@ -5,13 +5,22 @@ type ItemKind = 'flow' | 'script' | 'app'
/**
* Check whether a flow uses on_behalf_of_email.
* Callers use this to show a warning before saving.
*
* Returns `undefined` if the flow doesn't exist at that path (e.g. a draft, or
* a path the user is mid-edit). Missing-flow is a valid "no on-behalf" answer,
* not an error — and surfacing it via the global rejection handler would toast
* "Flow not found" while the user just opens the rename popover.
*/
export async function checkFlowOnBehalfOf(
workspace: string,
path: string
): Promise<string | undefined> {
const flow = await FlowService.getFlowByPath({ workspace, path })
return flow.on_behalf_of_email
try {
const flow = await FlowService.getFlowByPath({ workspace, path })
return flow.on_behalf_of_email
} catch {
return undefined
}
}
/**