form icon indicating copy to clipboard operation
form copied to clipboard

fix: getFieldProps should use initialValue when value does not exist

Open laysent opened this issue 7 years ago • 0 comments

This commit is trying to fix following issue:

props.getFieldProps('name', { initialValue: 'initial value' });
// or, equivalent
// props.setFieldsInitialValue({ name: 'initial value' });
// ...
console.log(props.getFieldValue('name')); // => output: initial value
console.log(props.getFieldProps('name').value); // => output: undefined

The issue here is, fieldOption in getFieldProps does not contain initialValue but fieldMeta has. Thus, to get the value, better merge meta first.

laysent avatar Oct 24 '18 06:10 laysent