Ensure we always set some value in Field
Always set some value on the Field's input so that it doesn't flip flop between controlled and uncontrolled.pull/21833/head
parent
ea050683bd
commit
5a648ecfe4
|
@ -88,8 +88,8 @@ export default class Field extends React.PureComponent {
|
||||||
|
|
||||||
inputProps.onChange = this.onChange;
|
inputProps.onChange = this.onChange;
|
||||||
// make sure we use the current `value` for the field and not the original one
|
// make sure we use the current `value` for the field and not the original one
|
||||||
if (this.value != undefined) {
|
if (inputProps.value === undefined) {
|
||||||
inputProps.value = this.value;
|
inputProps.value = this.value || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const fieldInput = React.createElement(inputElement, inputProps, children);
|
const fieldInput = React.createElement(inputElement, inputProps, children);
|
||||||
|
|
Loading…
Reference in New Issue