File tree Expand file tree Collapse file tree
datajunction-ui/src/app/pages/AddEditNodePage Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,10 +39,29 @@ export const FormikSelect = ({
3939 }
4040 } ;
4141
42+ // Convert Formik field value to React Select format
43+ const getSelectValue = ( ) => {
44+ if ( ! field . value ) {
45+ return isMulti ? [ ] : null ;
46+ }
47+
48+ if ( isMulti ) {
49+ // For multi-select, map array of values to option objects
50+ return Array . isArray ( field . value )
51+ ? field . value . map ( val =>
52+ selectOptions . find ( opt => opt . value === val ) || { value : val , label : val }
53+ )
54+ : [ ] ;
55+ } else {
56+ // For single-select, find the matching option
57+ return selectOptions . find ( opt => opt . value === field . value ) || null ;
58+ }
59+ } ;
60+
4261 return (
4362 < Select
4463 className = { className }
45- defaultValue = { defaultValue }
64+ value = { getSelectValue ( ) }
4665 options = { selectOptions }
4766 name = { field . name }
4867 placeholder = { placeholder }
You can’t perform that action at this time.
0 commit comments