@@ -64,11 +64,12 @@ import {
6464 normalizeErrorItem ,
6565 normalizeEventValue ,
6666 omit ,
67+ isPathsEqual ,
6768} from './utils' ;
6869import { FormContextKey } from './symbols' ;
6970import { validateTypedSchema , validateObjectSchema } from './validate' ;
7071import { refreshInspector , registerFormWithDevTools } from './devtools' ;
71- import { isCallable , merge } from '../../shared' ;
72+ import { isCallable , merge , normalizeFormPath } from '../../shared' ;
7273import { getConfig } from './config' ;
7374import { PartialDeep } from 'type-fest' ;
7475
@@ -143,7 +144,7 @@ export function useForm<
143144 const state = findPathState ( field ) ;
144145 if ( ! state ) {
145146 if ( typeof field === 'string' ) {
146- extraErrorsBag . value [ field ] = normalizeErrorItem ( message ) ;
147+ extraErrorsBag . value [ normalizeFormPath ( field ) as Path < TValues > ] = normalizeErrorItem ( message ) ;
147148 }
148149 return ;
149150 }
@@ -242,7 +243,7 @@ export function useForm<
242243 config ?: Partial < PathStateConfig >
243244 ) : PathState < TValue > {
244245 const initialValue = computed ( ( ) => getFromPath ( initialValues . value , toValue ( path ) ) ) ;
245- const pathStateExists = pathStates . value . find ( state => state . path === unref ( path ) ) ;
246+ const pathStateExists = pathStates . value . find ( s => isPathsEqual ( s . path , toValue ( path ) ) ) ;
246247 if ( pathStateExists ) {
247248 if ( config ?. type === 'checkbox' || config ?. type === 'radio' ) {
248249 pathStateExists . multiple = true ;
@@ -383,7 +384,7 @@ export function useForm<
383384 }
384385
385386 function findPathState < TPath extends Path < TValues > > ( path : TPath | PathState ) {
386- const pathState = typeof path === 'string' ? pathStates . value . find ( state => state . path === path ) : path ;
387+ const pathState = typeof path === 'string' ? pathStates . value . find ( s => isPathsEqual ( s . path , path ) ) : path ;
387388
388389 return pathState as PathState < PathValue < TValues , TPath > > | undefined ;
389390 }
@@ -493,7 +494,7 @@ export function useForm<
493494 handleSubmit . withControlled = makeSubmissionFactory ( true ) ;
494495
495496 function removePathState < TPath extends Path < TValues > > ( path : TPath , id : number ) {
496- const idx = pathStates . value . findIndex ( s => s . path === path ) ;
497+ const idx = pathStates . value . findIndex ( s => isPathsEqual ( s . path , path ) ) ;
497498 const pathState = pathStates . value [ idx ] ;
498499 if ( idx === - 1 || ! pathState ) {
499500 return ;
0 commit comments