Fix RHF data on bg update (#5045)

This commit is contained in:
Hariom Balhara
2022-10-17 11:21:49 +00:00
committed by GitHub
parent c1bc0286d1
commit aee1b3b596
@@ -1,5 +1,5 @@
import { App_RoutingForms_Form } from "@prisma/client";
import { useRouter } from "next/router";
import { useEffect } from "react";
import { useForm, UseFormReturn } from "react-hook-form";
import useApp from "@calcom/lib/hooks/useApp";
@@ -192,6 +192,10 @@ function SingleForm({ form, appUrl, Page }: SingleFormComponentProps) {
defaultValues: form,
});
useEffect(() => {
hookForm.reset(form);
}, [form, hookForm]);
const mutation = trpc.useMutation("viewer.app_routing_forms.formMutation", {
onSuccess() {
showToast("Form updated successfully.", "success");