From 02dab515435a6da0d86ba9bb2109c441fca97186 Mon Sep 17 00:00:00 2001 From: Mauryan Kansara Date: Tue, 18 Nov 2025 07:32:57 +0530 Subject: [PATCH] fix: Prevent silent loss of changes in routing form when only one field exists (#25197) --- apps/web/components/apps/routing-forms/Header.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/web/components/apps/routing-forms/Header.tsx b/apps/web/components/apps/routing-forms/Header.tsx index c32918736c..3540a5057f 100644 --- a/apps/web/components/apps/routing-forms/Header.tsx +++ b/apps/web/components/apps/routing-forms/Header.tsx @@ -23,7 +23,7 @@ const useRoutingFormNavigation = ( ) => { const pathname = usePathname(); const router = useRouter(); - const formContext = useFormContext(); + const { isDirty } = useFormContext().formState; // Get the current page based on the pathname since we use a custom routing system const getCurrentPage = () => { @@ -39,7 +39,7 @@ const useRoutingFormNavigation = ( const baseUrl = `${appUrl}/${value}/${form.id}`; - if (value === "route-builder" && formContext.formState.isDirty) { + if (value === "route-builder" && isDirty) { setShowInfoLostDialog(true); } else { router.push(baseUrl);