From deeb70807706c00e7baf9ec1c736c6e43b9c65ae Mon Sep 17 00:00:00 2001 From: Dominik Henneke Date: Tue, 31 Aug 2021 11:19:27 +0200 Subject: [PATCH] Provide the form context so nested controllers can use it Signed-off-by: Dominik Henneke --- .../PreparePullRequestForm.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/PreparePullRequestForm.tsx b/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/PreparePullRequestForm.tsx index 616e77518c..a1a20381f9 100644 --- a/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/PreparePullRequestForm.tsx +++ b/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/PreparePullRequestForm.tsx @@ -16,6 +16,7 @@ import React from 'react'; import { + FormProvider, SubmitHandler, UnpackNestedValue, useForm, @@ -55,12 +56,15 @@ export const PreparePullRequestForm = < onSubmit, render, }: Props) => { + const methods = useForm({ mode: 'onTouched', defaultValues }); const { handleSubmit, watch, control, register, formState, setValue } = - useForm({ mode: 'onTouched', defaultValues }); + methods; return ( -
- {render({ values: watch(), formState, register, control, setValue })} -
+ +
+ {render({ values: watch(), formState, register, control, setValue })} +
+
); };