diff --git a/src/libs/ReimbursementAccountUtils.js b/src/libs/ReimbursementAccountUtils.js index 4074f1e8ab6c6..2e6570880233b 100644 --- a/src/libs/ReimbursementAccountUtils.js +++ b/src/libs/ReimbursementAccountUtils.js @@ -35,6 +35,7 @@ function getDefaultStateForField(props, fieldName, defaultValue = '') { function getBankAccountFields(props, fieldNames) { return { ..._.pick(lodashGet(props, 'reimbursementAccount.achData'), ...fieldNames), + ..._.pick(lodashGet(props, 'reimbursementAccountDraftValues'), ...fieldNames), ..._.pick(props.reimbursementAccountDraft, ...fieldNames), }; } diff --git a/src/libs/actions/FormActions.js b/src/libs/actions/FormActions.js index 188d10b759b79..0cadc9236548a 100644 --- a/src/libs/actions/FormActions.js +++ b/src/libs/actions/FormActions.js @@ -24,7 +24,16 @@ function setDraftValues(formID, draftValues) { Onyx.merge(`${formID}DraftValues`, draftValues); } +/** + * @param {String} formID + * @returns {String} + */ +function getDraftValuesKey(formID) { + return `${formID}DraftValues`; +} + export { + getDraftValuesKey, setIsLoading, setErrors, setDraftValues, diff --git a/src/pages/ReimbursementAccount/CompanyStep.js b/src/pages/ReimbursementAccount/CompanyStep.js index 29ea6bfea723e..4c806b821f7e3 100644 --- a/src/pages/ReimbursementAccount/CompanyStep.js +++ b/src/pages/ReimbursementAccount/CompanyStep.js @@ -26,6 +26,7 @@ import AddressForm from './AddressForm'; import ReimbursementAccountForm from './ReimbursementAccountForm'; import * as ReimbursementAccount from '../../libs/actions/ReimbursementAccount'; import * as ReimbursementAccountUtils from '../../libs/ReimbursementAccountUtils'; +import * as FormActions from '../../libs/actions/FormActions'; const propTypes = { ...withLocalizePropTypes, @@ -312,6 +313,9 @@ export default compose( reimbursementAccountDraft: { key: ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT, }, + reimbursementAccountDraftValues: { + key: FormActions.getDraftValuesKey(ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM), + }, session: { key: ONYXKEYS.SESSION, },