Skip to content

Commit 02dab51

Browse files
authored
fix: Prevent silent loss of changes in routing form when only one field exists (calcom#25197)
1 parent 358b873 commit 02dab51

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

apps/web/components/apps/routing-forms/Header.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const useRoutingFormNavigation = (
2323
) => {
2424
const pathname = usePathname();
2525
const router = useRouter();
26-
const formContext = useFormContext<RoutingFormWithResponseCount>();
26+
const { isDirty } = useFormContext<RoutingFormWithResponseCount>().formState;
2727

2828
// Get the current page based on the pathname since we use a custom routing system
2929
const getCurrentPage = () => {
@@ -39,7 +39,7 @@ const useRoutingFormNavigation = (
3939

4040
const baseUrl = `${appUrl}/${value}/${form.id}`;
4141

42-
if (value === "route-builder" && formContext.formState.isDirty) {
42+
if (value === "route-builder" && isDirty) {
4343
setShowInfoLostDialog(true);
4444
} else {
4545
router.push(baseUrl);

0 commit comments

Comments
 (0)