From d7b5ec2bdff6a556cd705bdcfe6b668815e5c236 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 6 Oct 2022 13:54:42 -0600 Subject: [PATCH 1/6] rm draftvalues key --- src/libs/ReimbursementAccountUtils.js | 2 +- src/libs/actions/FormActions.js | 11 +---------- src/pages/ReimbursementAccount/CompanyStep.js | 3 --- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/libs/ReimbursementAccountUtils.js b/src/libs/ReimbursementAccountUtils.js index 2e6570880233b..6f8cb1cf05a65 100644 --- a/src/libs/ReimbursementAccountUtils.js +++ b/src/libs/ReimbursementAccountUtils.js @@ -35,7 +35,7 @@ function getDefaultStateForField(props, fieldName, defaultValue = '') { function getBankAccountFields(props, fieldNames) { return { ..._.pick(lodashGet(props, 'reimbursementAccount.achData'), ...fieldNames), - ..._.pick(lodashGet(props, 'reimbursementAccountDraftValues'), ...fieldNames), + ..._.pick(lodashGet(props, 'reimbursementAccountDraft'), ...fieldNames), ..._.pick(props.reimbursementAccountDraft, ...fieldNames), }; } diff --git a/src/libs/actions/FormActions.js b/src/libs/actions/FormActions.js index bb13e6dddac36..e81b8d28ace77 100644 --- a/src/libs/actions/FormActions.js +++ b/src/libs/actions/FormActions.js @@ -21,19 +21,10 @@ function setErrors(formID, errors) { * @param {Object} draftValues */ function setDraftValues(formID, draftValues) { - Onyx.merge(`${formID}DraftValues`, draftValues); -} - -/** - * @param {String} formID - * @returns {String} - */ -function getDraftValuesKey(formID) { - return `${formID}DraftValues`; + Onyx.merge(`${formID}Draft`, draftValues); } export { - getDraftValuesKey, setIsLoading, setErrors, setDraftValues, diff --git a/src/pages/ReimbursementAccount/CompanyStep.js b/src/pages/ReimbursementAccount/CompanyStep.js index 4c806b821f7e3..a075e7df22c67 100644 --- a/src/pages/ReimbursementAccount/CompanyStep.js +++ b/src/pages/ReimbursementAccount/CompanyStep.js @@ -313,9 +313,6 @@ export default compose( reimbursementAccountDraft: { key: ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT, }, - reimbursementAccountDraftValues: { - key: FormActions.getDraftValuesKey(ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM), - }, session: { key: ONYXKEYS.SESSION, }, From fe8d10d13a87ed9ac58d6e48e52baef469e990f3 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 6 Oct 2022 13:54:59 -0600 Subject: [PATCH 2/6] rm unused import --- src/pages/ReimbursementAccount/CompanyStep.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/ReimbursementAccount/CompanyStep.js b/src/pages/ReimbursementAccount/CompanyStep.js index a075e7df22c67..29ea6bfea723e 100644 --- a/src/pages/ReimbursementAccount/CompanyStep.js +++ b/src/pages/ReimbursementAccount/CompanyStep.js @@ -26,7 +26,6 @@ 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, From 6b7ea35f2a4ed318654a58f1c1b1930e432d81f9 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 6 Oct 2022 17:03:34 -0600 Subject: [PATCH 3/6] rm pick --- src/libs/ReimbursementAccountUtils.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/ReimbursementAccountUtils.js b/src/libs/ReimbursementAccountUtils.js index 6f8cb1cf05a65..4074f1e8ab6c6 100644 --- a/src/libs/ReimbursementAccountUtils.js +++ b/src/libs/ReimbursementAccountUtils.js @@ -35,7 +35,6 @@ function getDefaultStateForField(props, fieldName, defaultValue = '') { function getBankAccountFields(props, fieldNames) { return { ..._.pick(lodashGet(props, 'reimbursementAccount.achData'), ...fieldNames), - ..._.pick(lodashGet(props, 'reimbursementAccountDraft'), ...fieldNames), ..._.pick(props.reimbursementAccountDraft, ...fieldNames), }; } From b8ff23f098fb788bf5736df051239e7a11cae1d5 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Fri, 7 Oct 2022 10:03:56 -0600 Subject: [PATCH 4/6] revert changes to setDraftValues --- src/libs/actions/FormActions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/FormActions.js b/src/libs/actions/FormActions.js index e81b8d28ace77..39e9be9664a55 100644 --- a/src/libs/actions/FormActions.js +++ b/src/libs/actions/FormActions.js @@ -21,7 +21,7 @@ function setErrors(formID, errors) { * @param {Object} draftValues */ function setDraftValues(formID, draftValues) { - Onyx.merge(`${formID}Draft`, draftValues); + Onyx.merge(`${formID}DraftValues`, draftValues); } export { From 2cc1bcb2b83ad4a3423ffac87b3a6318c2abf80e Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Wed, 12 Oct 2022 08:29:44 -0600 Subject: [PATCH 5/6] set drafts only --- src/libs/actions/FormActions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/FormActions.js b/src/libs/actions/FormActions.js index 39e9be9664a55..e81b8d28ace77 100644 --- a/src/libs/actions/FormActions.js +++ b/src/libs/actions/FormActions.js @@ -21,7 +21,7 @@ function setErrors(formID, errors) { * @param {Object} draftValues */ function setDraftValues(formID, draftValues) { - Onyx.merge(`${formID}DraftValues`, draftValues); + Onyx.merge(`${formID}Draft`, draftValues); } export { From fdbaa04f15f9d5a785a546bd850840e1c3c09456 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Wed, 12 Oct 2022 08:30:43 -0600 Subject: [PATCH 6/6] update form to read drafts key --- src/components/Form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Form.js b/src/components/Form.js index b20ddc59c3f69..2b441f294c3b1 100644 --- a/src/components/Form.js +++ b/src/components/Form.js @@ -229,7 +229,7 @@ export default compose( key: props => props.formID, }, draftValues: { - key: props => `${props.formID}DraftValues`, + key: props => `${props.formID}Draft`, }, }), )(Form);