Fix RHF data on bg update (#5045)

pull/5044/head
Hariom Balhara 2022-10-17 16:51:49 +05:30 committed by GitHub
parent c1bc0286d1
commit aee1b3b596
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

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