File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import {
1212
1313import { cn } from '@/lib/tailwind/utils' ;
1414
15- import { useFormField } from '@/components/form/form-field' ;
15+ import { useFormFieldUnsafe } from '@/components/form/form-field' ;
1616
1717import {
1818 FormFieldControllerContext ,
@@ -38,7 +38,7 @@ export const FormFieldError = <
3838 children,
3939 ...props
4040} : FormFieldErrorProps < TFieldValues , TName > ) => {
41- const fieldCtx = useFormField ( ) ;
41+ const fieldCtx = useFormFieldUnsafe ( ) ;
4242 const controllerCtx = use < FormFieldControllerContextValue <
4343 TFieldValues ,
4444 TName
@@ -81,7 +81,7 @@ export const FormFieldError = <
8181
8282 return (
8383 < div
84- id = { fieldCtx . errorId }
84+ id = { fieldCtx ? .errorId }
8585 className = { cn (
8686 'flex animate-in gap-1 text-sm text-negative-600 slide-in-from-top-1 dark:text-negative-400' ,
8787 className
Original file line number Diff line number Diff line change @@ -54,3 +54,7 @@ export const useFormField = () => {
5454 }
5555 return fieldContext ;
5656} ;
57+
58+ export const useFormFieldUnsafe = ( ) => {
59+ return use ( FormFieldContext ) ;
60+ } ;
You can’t perform that action at this time.
0 commit comments