From f99deb07218667d540a0266c379b88ca5e2e194a Mon Sep 17 00:00:00 2001 From: Stephanya Casanova Date: Wed, 5 Jun 2024 15:55:08 +0200 Subject: [PATCH] [backend] refact --- .../src/admin/components/settings/policies/PolicyForm.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openbas-front/src/admin/components/settings/policies/PolicyForm.tsx b/openbas-front/src/admin/components/settings/policies/PolicyForm.tsx index 48362deb6c..2cb745a9dd 100644 --- a/openbas-front/src/admin/components/settings/policies/PolicyForm.tsx +++ b/openbas-front/src/admin/components/settings/policies/PolicyForm.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import { useForm, FormProvider, SubmitHandler } from 'react-hook-form'; import { Button } from '@mui/material'; import MarkDownField from '../../../../components/fields/MarkDownField'; @@ -28,8 +28,13 @@ const PolicyForm: React.FC = ({ const { handleSubmit, formState: { isDirty, isSubmitting }, + reset, } = methods; + useEffect(() => { + reset(initialValues); + }, [initialValues, reset]); + return (