From 0b8d47f667d5bb887cf70a6f7ec34e36b337a826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Sworze=C5=84?= Date: Wed, 6 Mar 2024 20:56:34 +0100 Subject: [PATCH] [#362] fix display data only for one type of GA --- .../src/components/organisms/CreateGovernanceActionForm.tsx | 3 ++- .../frontend/src/hooks/forms/useCreateGovernanceActionForm.ts | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/govtool/frontend/src/components/organisms/CreateGovernanceActionForm.tsx b/govtool/frontend/src/components/organisms/CreateGovernanceActionForm.tsx index e56f1a60c..b48a536af 100644 --- a/govtool/frontend/src/components/organisms/CreateGovernanceActionForm.tsx +++ b/govtool/frontend/src/components/organisms/CreateGovernanceActionForm.tsx @@ -21,7 +21,7 @@ export const CreateGovernanceActionForm = ({ setStep, }: ChooseGovernanceActionTypeProps) => { const { t } = useTranslation(); - const { control, errors, getValues, register, watch } = + const { control, errors, getValues, register, reset, watch } = useCreateGovernanceActionForm(); const { append, @@ -48,6 +48,7 @@ export const CreateGovernanceActionForm = ({ }; const onClickBack = () => { + reset(); setStep(2); }; diff --git a/govtool/frontend/src/hooks/forms/useCreateGovernanceActionForm.ts b/govtool/frontend/src/hooks/forms/useCreateGovernanceActionForm.ts index 6926ff184..f744484b2 100644 --- a/govtool/frontend/src/hooks/forms/useCreateGovernanceActionForm.ts +++ b/govtool/frontend/src/hooks/forms/useCreateGovernanceActionForm.ts @@ -23,6 +23,7 @@ export const useCreateGovernanceActionForm = () => { setValue, watch, register, + reset, } = useFormContext(); const onSubmit = useCallback(async () => { @@ -44,5 +45,6 @@ export const useCreateGovernanceActionForm = () => { submitForm: handleSubmit(onSubmit), watch, register, + reset, }; };