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
J. Ryan Stinnett 2019-03-07 16:41:44 +00:00
parent ea050683bd
commit 5a648ecfe4
1 changed files with 2 additions and 2 deletions

View File

@ -88,8 +88,8 @@ export default class Field extends React.PureComponent {
inputProps.onChange = this.onChange;
// make sure we use the current `value` for the field and not the original one
if (this.value != undefined) {
inputProps.value = this.value;
if (inputProps.value === undefined) {
inputProps.value = this.value || "";
}
const fieldInput = React.createElement(inputElement, inputProps, children);