From ca33cd100e0b0ff1cfa95fcdb5952befda645fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dafydd=20Ll=C5=B7r=20Pearson?= Date: Thu, 30 May 2024 09:52:01 +0100 Subject: [PATCH] feat: Improve flow status form UX (#3212) --- .../FlowEditor/components/Settings/ServiceSettings.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Settings/ServiceSettings.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Settings/ServiceSettings.tsx index 849c5a9b91..d56abc8aa1 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Settings/ServiceSettings.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Settings/ServiceSettings.tsx @@ -129,9 +129,13 @@ const ServiceSettings: React.FC = () => { initialValues: { status: flowStatus || "online", }, - onSubmit: async ({ status }) => { - await updateFlowStatus(status); - setIsAlertOpen(true); + onSubmit: async (values, { resetForm }) => { + const isSuccess = await updateFlowStatus(values.status); + if (isSuccess) { + setIsAlertOpen(true); + // Reset "dirty" status to disable Save & Reset buttons + resetForm({ values }); + } }, });