File tree Expand file tree Collapse file tree 2 files changed +2
-5
lines changed Expand file tree Collapse file tree 2 files changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,7 @@ export default function toFieldPathId(
2424 // Generate name attribute if nameGenerator is provided
2525 let name : string | undefined ;
2626 if ( globalFormOptions . nameGenerator && path . length > 0 ) {
27- // Determine element type based on the last element in the path
28- const lastPathElement = path [ path . length - 1 ] ;
29- const elementType = typeof lastPathElement === 'number' ? 'array' : 'object' ;
30- name = globalFormOptions . nameGenerator ( path , elementType ) ;
27+ name = globalFormOptions . nameGenerator ( path , globalFormOptions . idPrefix ) ;
3128 }
3229
3330 return { path, [ ID_KEY ] : id , ...( name !== undefined && { name } ) } ;
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export type FormContextType = GenericObjectType;
3636export type TestIdShape = Record < string , string > ;
3737
3838/** Function to generate HTML name attributes from path segments */
39- export type NameGeneratorFunction = ( path : FieldPathList , elementType : 'object' | 'array' ) => string ;
39+ export type NameGeneratorFunction = ( path : FieldPathList , idPrefix : string ) => string ;
4040
4141/** Experimental feature that specifies the Array `minItems` default form state behavior
4242 */
You can’t perform that action at this time.
0 commit comments