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 {
12
12
13
13
import { cn } from '@/lib/tailwind/utils' ;
14
14
15
- import { useFormField } from '@/components/form/form-field' ;
15
+ import { useFormFieldUnsafe } from '@/components/form/form-field' ;
16
16
17
17
import {
18
18
FormFieldControllerContext ,
@@ -38,7 +38,7 @@ export const FormFieldError = <
38
38
children,
39
39
...props
40
40
} : FormFieldErrorProps < TFieldValues , TName > ) => {
41
- const fieldCtx = useFormField ( ) ;
41
+ const fieldCtx = useFormFieldUnsafe ( ) ;
42
42
const controllerCtx = use < FormFieldControllerContextValue <
43
43
TFieldValues ,
44
44
TName
@@ -81,7 +81,7 @@ export const FormFieldError = <
81
81
82
82
return (
83
83
< div
84
- id = { fieldCtx . errorId }
84
+ id = { fieldCtx ? .errorId }
85
85
className = { cn (
86
86
'flex animate-in gap-1 text-sm text-negative-600 slide-in-from-top-1 dark:text-negative-400' ,
87
87
className
Original file line number Diff line number Diff line change @@ -54,3 +54,7 @@ export const useFormField = () => {
54
54
}
55
55
return fieldContext ;
56
56
} ;
57
+
58
+ export const useFormFieldUnsafe = ( ) => {
59
+ return use ( FormFieldContext ) ;
60
+ } ;
You can’t perform that action at this time.
0 commit comments