Skip to content

Commit

Permalink
Merge pull request #8677 from Expensify/cmartins-formShouldSaveDraft
Browse files Browse the repository at this point in the history
Only set inputValues when undefined
  • Loading branch information
ctkochan22 authored Apr 19, 2022
2 parents 1aeeb30 + 2bcf3c8 commit 2f02241
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ class Form extends React.Component {
// We clone the child passing down all form props
const inputID = child.props.inputID;
const defaultValue = this.props.draftValues[inputID] || child.props.defaultValue;
this.inputValues[inputID] = defaultValue;

// We want to initialize the input value if it's undefined
if (_.isUndefined(this.inputValues[inputID])) {
this.inputValues[inputID] = defaultValue;
}

return React.cloneElement(child, {
ref: node => this.inputRefs[inputID] = node,
Expand Down

0 comments on commit 2f02241

Please sign in to comment.