fix: email preferences form reset (#4464)

This commit is contained in:
Anmol Singh Bhatia 2024-05-16 19:42:18 +05:30 committed by GitHub
parent e6142d8247
commit fd4aa38dc2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,4 @@
import React, { FC } from "react";
import React, { FC, useEffect } from "react";
import { Controller, useForm } from "react-hook-form";
import { IUserEmailNotificationSettings } from "@plane/types";
// ui
@ -22,6 +22,7 @@ export const EmailNotificationForm: FC<IEmailNotificationFormProps> = (props) =>
watch,
control,
setValue,
reset,
formState: { isSubmitting, isDirty, dirtyFields },
} = useForm<IUserEmailNotificationSettings>({
defaultValues: {
@ -50,6 +51,10 @@ export const EmailNotificationForm: FC<IEmailNotificationFormProps> = (props) =>
.catch((err) => console.error(err));
};
useEffect(() => {
reset(data);
}, [reset, data]);
return (
<>
<div className="flex gap-2 items-center pt-6 mb-2 pb-6 border-b border-custom-border-100">