diff --git a/frontend/src/lib/components/moveRenameManager.ts b/frontend/src/lib/components/moveRenameManager.ts index 61a40f5b25..18030eb405 100644 --- a/frontend/src/lib/components/moveRenameManager.ts +++ b/frontend/src/lib/components/moveRenameManager.ts @@ -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 { - 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 + } } /**