forked from github/plane
fix: email preferences form reset (#4464)
This commit is contained in:
parent
e6142d8247
commit
fd4aa38dc2
@ -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">
|
||||
|
Loading…
Reference in New Issue
Block a user