File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
frontend/packages/pydantic-forms/src Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,13 @@ export const itemizeArrayItem = (
9494 return itemize ( item , itemId ) ;
9595} ;
9696
97+ /**
98+ * This functions returns a fields value but taking into account the position
99+ * of the field in any tree it might be in. For example when requesting the
100+ * 'age' field it will return the sibling field called 'age'. This is relevant
101+ * if the field is part of an array or object where there might be more 'age'
102+ * fields on other levels
103+ * */
97104export function getFormFieldValue (
98105 fieldName : string ,
99106 formValues : FieldValues ,
@@ -103,7 +110,7 @@ export function getFormFieldValue(
103110 let current : FieldValues = { ...formValues } ;
104111
105112 for ( const segment of pathToParent ) {
106- // Try to convert numeric strings to numbers for array indexing
113+ // Convert numeric strings to numbers for array indexing
107114 const key = isNaN ( Number ( segment ) ) ? segment : Number ( segment ) ;
108115 if ( current && key in current ) {
109116 current = current [ key ] ;
You can’t perform that action at this time.
0 commit comments