diff --git a/editor.planx.uk/src/pages/Team.tsx b/editor.planx.uk/src/pages/Team.tsx index d3851ed023..58e0238ccf 100644 --- a/editor.planx.uk/src/pages/Team.tsx +++ b/editor.planx.uk/src/pages/Team.tsx @@ -325,12 +325,20 @@ const Team: React.FC = () => { const newFlowName = prompt("Service name"); if (newFlowName) { const newFlowSlug = slugify(newFlowName); - useStore - .getState() - .createFlow(teamId, newFlowSlug, newFlowName) - .then((newId: string) => { - navigation.navigate(`/${slug}/${newId}`); - }); + const duplicateFlowName = flows?.find( + (flow) => flow.slug === newFlowSlug, + ); + + !duplicateFlowName + ? useStore + .getState() + .createFlow(teamId, newFlowSlug, newFlowName) + .then((newId: string) => { + navigation.navigate(`/${slug}/${newId}`); + }) + : alert( + `The flow "${newFlowName}" already exists. Enter a unique flow name to continue`, + ); } }} >