const handelChange = useCallback( (value: any) => { console.log('Setting handelChange',…
- User
const handelChange = useCallback( (value: any) => { console.log('Setting handelChange', value,
['${settings?.name}']); formik.setFieldValue(['${settings?.name}'], value); formik.setFieldValue(['MinMaxScaler.feature_range'], value); formik.setFieldValue(['MinMaxScaler.clip'], value); // onChange(['${settings?.name}'], value); setTimeout(() => { console.log('formik', formik.values); }, 1000); }, [onChange, settings?.name, formik],Параметр clip обновляется а параметр feature_range нет
- Assistant
В коде, который вы предоставили, параметр
clipобновляется, потому что указана соответствующая строка кода:formik.setFieldValue(['MinMaxScaler.clip'], value);.Однако параметр
feature_rangeне обновляется в коде, что может быть вызвано отсутствием соответствующей строки кода. Если вы хотите обновить параметрfeature_range, вам необходимо добавить строку кода, аналогичную строке кода для параметраclip, например:formik.setFieldValue(`['MinMaxScaler.feature_range']`, value); - User
в коде есть обновление feature_range
- Assistant
Прошу прощения за недоразумение. Вы правы, в коде имеется обновление параметра
feature_range.Строка кода, которая отвечает за обновление
feature_range, выглядит следующим образом:formik.setFieldValue(`['MinMaxScaler.feature_range']`, value);Таким образом, обновление
feature_rangeуже выполняется в вашем коде. - User
но обновляется только clip по факту
- Assistant
I apologize for the confusion. It seems that there might be an issue with the code logic or how the formik fields are set up.
To troubleshoot the issue, you can try the following steps:
-
Verify that the
nameproperty of thesettingsobject is correctly provided. Double-check if thenameproperty matches the correct field name in the formik form. -
Consider checking the formik form structure and make sure that the
feature_rangefield is correctly defined. -
Check if any other parts of your code are interfering with the formik field update specifically for the
feature_rangefield. It's possible that there might be conflicting logic or an override happening elsewhere.
If you're still facing issues, providing more details about the formik form structure and any relevant code surrounding the form submission can help in further troubleshooting.
-