From 00cca296a81f3b133c6f08af822cde4d65827586 Mon Sep 17 00:00:00 2001 From: Kid <44045911+kidonng@users.noreply.github.com> Date: Thu, 8 May 2025 05:13:00 +0000 Subject: [PATCH 1/3] feat(react-form): add `displayName` to `` & `` --- packages/react-form/src/createFormHook.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/react-form/src/createFormHook.tsx b/packages/react-form/src/createFormHook.tsx index 6a4140768..1ce8e34e1 100644 --- a/packages/react-form/src/createFormHook.tsx +++ b/packages/react-form/src/createFormHook.tsx @@ -270,15 +270,17 @@ export function createFormHook< const form = useForm(props) const AppForm = useMemo(() => { - return (({ children }) => { + const AppForm = (({ children }) => { return ( {children} ) }) as ComponentType + AppForm.displayName = 'AppForm' + return AppForm }, [form]) const AppField = useMemo(() => { - return (({ children, ...props }) => { + const AppField = (({ children, ...props }) => { return ( {(field) => ( @@ -302,6 +304,9 @@ export function createFormHook< TSubmitMeta, TComponents > + // @ts-expect-error React component property + AppField.displayName = 'AppField' + return AppField }, [form]) const extendedForm = useMemo(() => { From 1dd92d814c9d92f07dd28cb9c3913842651a1c92 Mon Sep 17 00:00:00 2001 From: Kid <44045911+kidonng@users.noreply.github.com> Date: Thu, 8 May 2025 05:36:44 +0000 Subject: [PATCH 2/3] Stop assigning `.displayName` --- packages/react-form/src/createFormHook.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/react-form/src/createFormHook.tsx b/packages/react-form/src/createFormHook.tsx index 1ce8e34e1..af0aa3973 100644 --- a/packages/react-form/src/createFormHook.tsx +++ b/packages/react-form/src/createFormHook.tsx @@ -275,7 +275,6 @@ export function createFormHook< {children} ) }) as ComponentType - AppForm.displayName = 'AppForm' return AppForm }, [form]) @@ -304,8 +303,6 @@ export function createFormHook< TSubmitMeta, TComponents > - // @ts-expect-error React component property - AppField.displayName = 'AppField' return AppField }, [form]) From 714de5934b27a4b94109197197c24bf967ba563a Mon Sep 17 00:00:00 2001 From: Kid <44045911+kidonng@users.noreply.github.com> Date: Thu, 8 May 2025 05:37:05 +0000 Subject: [PATCH 3/3] Add name to `` --- packages/react-form/src/useForm.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-form/src/useForm.tsx b/packages/react-form/src/useForm.tsx index 729064aba..639d44e16 100644 --- a/packages/react-form/src/useForm.tsx +++ b/packages/react-form/src/useForm.tsx @@ -193,7 +193,7 @@ export function useForm< extendedApi.Field = function APIField(props) { return } - extendedApi.Subscribe = (props: any) => { + extendedApi.Subscribe = function Subscribe(props: any) { return (