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);