From 33e8fdb511bf43624b38b836ed9a77983d708975 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Wed, 4 Oct 2023 15:37:30 -0600 Subject: [PATCH 1/9] Remove some of the duplicate withOnyx calls --- .eslintrc.js | 1 - .../LHNOptionsList/OptionRowLHNData.js | 12 +++------ src/pages/EditRequestPage.js | 14 +++++----- src/pages/iou/MoneyRequestTagPage.js | 27 ++++++++----------- .../iou/steps/MoneyRequestConfirmPage.js | 6 ----- 5 files changed, 21 insertions(+), 39 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 75a74ed371c4..3b480fcc4639 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -38,7 +38,6 @@ module.exports = { { files: ['*.js', '*.jsx', '*.ts', '*.tsx'], rules: { - 'rulesdir/no-multiple-onyx-in-file': 'off', 'rulesdir/onyx-props-must-have-default': 'off', 'react-native-a11y/has-accessibility-hint': ['off'], 'react-native-a11y/has-valid-accessibility-descriptors': [ diff --git a/src/components/LHNOptionsList/OptionRowLHNData.js b/src/components/LHNOptionsList/OptionRowLHNData.js index 87358f05b9c9..b3ea768db50d 100644 --- a/src/components/LHNOptionsList/OptionRowLHNData.js +++ b/src/components/LHNOptionsList/OptionRowLHNData.js @@ -195,27 +195,21 @@ export default React.memo( preferredLocale: { key: ONYXKEYS.NVP_PREFERRED_LOCALE, }, - }), - // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file - withOnyx({ parentReportActions: { - key: ({fullReport}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${fullReport.parentReportID}`, + key: ({fullReport}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${fullReport ? fullReport.parentReportID : 0}`, canEvict: false, }, policy: { - key: ({fullReport}) => `${ONYXKEYS.COLLECTION.POLICY}${fullReport.policyID}`, + key: ({fullReport}) => `${ONYXKEYS.COLLECTION.POLICY}${fullReport ? fullReport.policyID : 0}`, }, // Ideally, we aim to access only the last transaction for the current report by listening to changes in reportActions. // In some scenarios, a transaction might be created after reportActions have been modified. // This can lead to situations where `lastTransaction` doesn't update and retains the previous value. // However, performance overhead of this is minimized by using memos inside the component. receiptTransactions: {key: ONYXKEYS.COLLECTION.TRANSACTION}, - }), - // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file - withOnyx({ transaction: { key: ({fullReport, parentReportActions}) => - `${ONYXKEYS.COLLECTION.TRANSACTION}${lodashGet(parentReportActions, [fullReport.parentReportActionID, 'originalMessage', 'IOUTransactionID'], '')}`, + `${ONYXKEYS.COLLECTION.TRANSACTION}${fullReport ? lodashGet(parentReportActions, [fullReport.parentReportActionID, 'originalMessage', 'IOUTransactionID'], 0) : 0}`, }, }), )(OptionRowLHNData), diff --git a/src/pages/EditRequestPage.js b/src/pages/EditRequestPage.js index a0c60fe597fa..e13226739c36 100644 --- a/src/pages/EditRequestPage.js +++ b/src/pages/EditRequestPage.js @@ -291,21 +291,21 @@ EditRequestPage.propTypes = propTypes; EditRequestPage.defaultProps = defaultProps; export default compose( withCurrentUserPersonalDetails, - withOnyx({ - report: { - key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${route.params.threadReportID}`, - }, - }), - // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file withOnyx({ betas: { key: ONYXKEYS.BETAS, }, + report: { + key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${route.params.threadReportID}`, + }, parentReport: { key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT}${report ? report.parentReportID : '0'}`, }, policy: { - key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY}${report ? report.policyID : '0'}`, + key: (props) => { + console.log('[tim] props', props.report, props); + return `${ONYXKEYS.COLLECTION.POLICY}${props.report ? props.report.policyID : '0'}`; + }, }, policyCategories: { key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${report ? report.policyID : '0'}`, diff --git a/src/pages/iou/MoneyRequestTagPage.js b/src/pages/iou/MoneyRequestTagPage.js index 43c0cd9d1480..eb89b2b5a9b3 100644 --- a/src/pages/iou/MoneyRequestTagPage.js +++ b/src/pages/iou/MoneyRequestTagPage.js @@ -96,19 +96,14 @@ MoneyRequestTagPage.displayName = 'MoneyRequestTagPage'; MoneyRequestTagPage.propTypes = propTypes; MoneyRequestTagPage.defaultProps = defaultProps; -export default compose( - withOnyx({ - report: { - key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${lodashGet(route, 'params.reportID')}`, - }, - iou: { - key: ONYXKEYS.IOU, - }, - }), - // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file - withOnyx({ - policyTags: { - key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY_TAGS}${report ? report.policyID : '0'}`, - }, - }), -)(MoneyRequestTagPage); +export default withOnyx({ + report: { + key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${lodashGet(route, 'params.reportID')}`, + }, + iou: { + key: ONYXKEYS.IOU, + }, + policyTags: { + key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY_TAGS}${report ? report.policyID : '0'}`, + }, +})(MoneyRequestTagPage); diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 3881221d5c52..c163dc917d1d 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -370,9 +370,6 @@ export default compose( iou: { key: ONYXKEYS.IOU, }, - }), - // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file - withOnyx({ report: { key: ({route, iou}) => { let reportID = lodashGet(route, 'params.reportID', ''); @@ -390,9 +387,6 @@ export default compose( selectedTab: { key: `${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.RECEIPT_TAB_ID}`, }, - }), - // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file - withOnyx({ policy: { key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY}${report ? report.policyID : '0'}`, }, From 1478c417c2bee0b2ecbbc16030e4cad05cdf0ed3 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Wed, 4 Oct 2023 16:09:16 -0600 Subject: [PATCH 2/9] Fix lint and remove console log --- src/pages/EditRequestPage.js | 5 +---- src/pages/iou/MoneyRequestTagPage.js | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pages/EditRequestPage.js b/src/pages/EditRequestPage.js index e13226739c36..fe7f12f6bbad 100644 --- a/src/pages/EditRequestPage.js +++ b/src/pages/EditRequestPage.js @@ -302,10 +302,7 @@ export default compose( key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT}${report ? report.parentReportID : '0'}`, }, policy: { - key: (props) => { - console.log('[tim] props', props.report, props); - return `${ONYXKEYS.COLLECTION.POLICY}${props.report ? props.report.policyID : '0'}`; - }, + key: (props) => `${ONYXKEYS.COLLECTION.POLICY}${props.report ? props.report.policyID : '0'}`, }, policyCategories: { key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${report ? report.policyID : '0'}`, diff --git a/src/pages/iou/MoneyRequestTagPage.js b/src/pages/iou/MoneyRequestTagPage.js index eb89b2b5a9b3..575da237d7e7 100644 --- a/src/pages/iou/MoneyRequestTagPage.js +++ b/src/pages/iou/MoneyRequestTagPage.js @@ -3,7 +3,6 @@ import _ from 'underscore'; import PropTypes from 'prop-types'; import lodashGet from 'lodash/get'; import {withOnyx} from 'react-native-onyx'; -import compose from '../../libs/compose'; import ROUTES from '../../ROUTES'; import * as IOU from '../../libs/actions/IOU'; import * as PolicyUtils from '../../libs/PolicyUtils'; From 2253e4aa819725ba9f76f50f5b7e4451acb735bd Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Tue, 17 Oct 2023 10:39:21 -0600 Subject: [PATCH 3/9] Remove some more nested references --- src/components/MoneyRequestHeader.js | 40 ++++++++++------------- src/pages/EditRequestPage.js | 6 ---- src/pages/EditSplitBillPage.js | 38 +++++++++------------ src/pages/ProfilePage.js | 3 -- src/pages/iou/MoneyRequestCategoryPage.js | 26 ++++++--------- src/pages/iou/SplitBillDetailsPage.js | 3 -- 6 files changed, 43 insertions(+), 73 deletions(-) diff --git a/src/components/MoneyRequestHeader.js b/src/components/MoneyRequestHeader.js index 086e1429baef..6bbdbf294beb 100644 --- a/src/components/MoneyRequestHeader.js +++ b/src/components/MoneyRequestHeader.js @@ -6,7 +6,6 @@ import lodashGet from 'lodash/get'; import HeaderWithBackButton from './HeaderWithBackButton'; import iouReportPropTypes from '../pages/iouReportPropTypes'; import * as ReportUtils from '../libs/ReportUtils'; -import compose from '../libs/compose'; import * as Expensicons from './Icon/Expensicons'; import participantPropTypes from './participantPropTypes'; import styles from '../styles/styles'; @@ -162,26 +161,21 @@ MoneyRequestHeader.displayName = 'MoneyRequestHeader'; MoneyRequestHeader.propTypes = propTypes; MoneyRequestHeader.defaultProps = defaultProps; -export default compose( - withOnyx({ - session: { - key: ONYXKEYS.SESSION, - }, - parentReport: { - key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID}`, - }, - parentReportActions: { - key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report ? report.parentReportID : '0'}`, - canEvict: false, - }, - }), - // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file - withOnyx({ - transaction: { - key: ({report, parentReportActions}) => { - const parentReportAction = lodashGet(parentReportActions, [report.parentReportActionID]); - return `${ONYXKEYS.COLLECTION.TRANSACTION}${lodashGet(parentReportAction, 'originalMessage.IOUTransactionID', 0)}`; - }, +export default withOnyx({ + session: { + key: ONYXKEYS.SESSION, + }, + parentReport: { + key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID}`, + }, + parentReportActions: { + key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report ? report.parentReportID : '0'}`, + canEvict: false, + }, + transaction: { + key: ({report, parentReportActions}) => { + const parentReportAction = lodashGet(parentReportActions, [report.parentReportActionID]); + return `${ONYXKEYS.COLLECTION.TRANSACTION}${lodashGet(parentReportAction, 'originalMessage.IOUTransactionID', 0)}`; }, - }), -)(MoneyRequestHeader); + }, +})(MoneyRequestHeader); diff --git a/src/pages/EditRequestPage.js b/src/pages/EditRequestPage.js index ad5a7815feb9..e55210500dce 100644 --- a/src/pages/EditRequestPage.js +++ b/src/pages/EditRequestPage.js @@ -308,9 +308,6 @@ export default compose( report: { key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${route.params.threadReportID}`, }, - }), - // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file - withOnyx({ policy: { key: (props) => `${ONYXKEYS.COLLECTION.POLICY}${props.report ? props.report.policyID : '0'}`, }, @@ -327,9 +324,6 @@ export default compose( key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report ? report.parentReportID : '0'}`, canEvict: false, }, - }), - // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file - withOnyx({ transaction: { key: ({report, parentReportActions}) => { const parentReportActionID = lodashGet(report, 'parentReportActionID', '0'); diff --git a/src/pages/EditSplitBillPage.js b/src/pages/EditSplitBillPage.js index d10803cd40ea..2c9e6aa7651a 100644 --- a/src/pages/EditSplitBillPage.js +++ b/src/pages/EditSplitBillPage.js @@ -5,7 +5,6 @@ import {withOnyx} from 'react-native-onyx'; import CONST from '../CONST'; import ROUTES from '../ROUTES'; import ONYXKEYS from '../ONYXKEYS'; -import compose from '../libs/compose'; import transactionPropTypes from '../components/transactionPropTypes'; import * as ReportUtils from '../libs/ReportUtils'; import * as IOU from '../libs/actions/IOU'; @@ -136,26 +135,21 @@ function EditSplitBillPage({route, transaction, draftTransaction}) { EditSplitBillPage.displayName = 'EditSplitBillPage'; EditSplitBillPage.propTypes = propTypes; EditSplitBillPage.defaultProps = defaultProps; -export default compose( - withOnyx({ - reportActions: { - key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${route.params.reportID}`, - canEvict: false, +export default withOnyx({ + reportActions: { + key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${route.params.reportID}`, + canEvict: false, + }, + transaction: { + key: ({route, reportActions}) => { + const reportAction = reportActions[`${route.params.reportActionID.toString()}`]; + return `${ONYXKEYS.COLLECTION.TRANSACTION}${lodashGet(reportAction, 'originalMessage.IOUTransactionID', 0)}`; }, - }), - // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file - withOnyx({ - transaction: { - key: ({route, reportActions}) => { - const reportAction = reportActions[`${route.params.reportActionID.toString()}`]; - return `${ONYXKEYS.COLLECTION.TRANSACTION}${lodashGet(reportAction, 'originalMessage.IOUTransactionID', 0)}`; - }, + }, + draftTransaction: { + key: ({route, reportActions}) => { + const reportAction = reportActions[`${route.params.reportActionID.toString()}`]; + return `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${lodashGet(reportAction, 'originalMessage.IOUTransactionID', 0)}`; }, - draftTransaction: { - key: ({route, reportActions}) => { - const reportAction = reportActions[`${route.params.reportActionID.toString()}`]; - return `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${lodashGet(reportAction, 'originalMessage.IOUTransactionID', 0)}`; - }, - }, - }), -)(EditSplitBillPage); + }, +})(EditSplitBillPage); diff --git a/src/pages/ProfilePage.js b/src/pages/ProfilePage.js index 8e0ed04ab94a..bdcae5303cbf 100755 --- a/src/pages/ProfilePage.js +++ b/src/pages/ProfilePage.js @@ -301,9 +301,6 @@ export default compose( session: { key: ONYXKEYS.SESSION, }, - }), - // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file - withOnyx({ report: { key: ({route, session}) => { const accountID = Number(lodashGet(route.params, 'accountID', 0)); diff --git a/src/pages/iou/MoneyRequestCategoryPage.js b/src/pages/iou/MoneyRequestCategoryPage.js index 5055c9f90f8a..bdb9446dbfbd 100644 --- a/src/pages/iou/MoneyRequestCategoryPage.js +++ b/src/pages/iou/MoneyRequestCategoryPage.js @@ -2,7 +2,6 @@ import React from 'react'; import PropTypes from 'prop-types'; import lodashGet from 'lodash/get'; import {withOnyx} from 'react-native-onyx'; -import compose from '../../libs/compose'; import ROUTES from '../../ROUTES'; import Navigation from '../../libs/Navigation/Navigation'; import useLocalize from '../../hooks/useLocalize'; @@ -84,20 +83,15 @@ MoneyRequestCategoryPage.displayName = 'MoneyRequestCategoryPage'; MoneyRequestCategoryPage.propTypes = propTypes; MoneyRequestCategoryPage.defaultProps = defaultProps; -export default compose( - withOnyx({ - iou: { - key: ONYXKEYS.IOU, - }, - }), - // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file - withOnyx({ - report: { - key: ({route, iou}) => { - const reportID = IOU.getIOUReportID(iou, route); +export default withOnyx({ + iou: { + key: ONYXKEYS.IOU, + }, + report: { + key: ({route, iou}) => { + const reportID = IOU.getIOUReportID(iou, route); - return `${ONYXKEYS.COLLECTION.REPORT}${reportID}`; - }, + return `${ONYXKEYS.COLLECTION.REPORT}${reportID}`; }, - }), -)(MoneyRequestCategoryPage); + }, +})(MoneyRequestCategoryPage); diff --git a/src/pages/iou/SplitBillDetailsPage.js b/src/pages/iou/SplitBillDetailsPage.js index e29fc8ce017e..a9dbad1acc42 100644 --- a/src/pages/iou/SplitBillDetailsPage.js +++ b/src/pages/iou/SplitBillDetailsPage.js @@ -173,9 +173,6 @@ export default compose( session: { key: ONYXKEYS.SESSION, }, - }), - // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file - withOnyx({ transaction: { key: ({route, reportActions}) => { const reportAction = reportActions[`${route.params.reportActionID.toString()}`]; From 5a938018ac27c17008591ca05d15dd45b9749be8 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Tue, 17 Oct 2023 11:11:41 -0600 Subject: [PATCH 4/9] Simplify withOnyx keys --- src/pages/iou/MoneyRequestCategoryPage.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pages/iou/MoneyRequestCategoryPage.js b/src/pages/iou/MoneyRequestCategoryPage.js index bdb9446dbfbd..7850959aaca4 100644 --- a/src/pages/iou/MoneyRequestCategoryPage.js +++ b/src/pages/iou/MoneyRequestCategoryPage.js @@ -88,10 +88,6 @@ export default withOnyx({ key: ONYXKEYS.IOU, }, report: { - key: ({route, iou}) => { - const reportID = IOU.getIOUReportID(iou, route); - - return `${ONYXKEYS.COLLECTION.REPORT}${reportID}`; - }, + key: ({route, iou}) => `${ONYXKEYS.COLLECTION.REPORT}${IOU.getIOUReportID(iou, route)}`, }, })(MoneyRequestCategoryPage); From 21dbdb7051b91db61f8af6055699ceca67080bd1 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Tue, 17 Oct 2023 11:11:52 -0600 Subject: [PATCH 5/9] Simplify another key --- src/components/MoneyRequestHeader.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/MoneyRequestHeader.js b/src/components/MoneyRequestHeader.js index 6bbdbf294beb..d6f2a6911b02 100644 --- a/src/components/MoneyRequestHeader.js +++ b/src/components/MoneyRequestHeader.js @@ -166,10 +166,10 @@ export default withOnyx({ key: ONYXKEYS.SESSION, }, parentReport: { - key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID}`, + key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT}${report ? report.parentReportID : 0}`, }, parentReportActions: { - key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report ? report.parentReportID : '0'}`, + key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report ? report.parentReportID : 0}`, canEvict: false, }, transaction: { From bd4e4a5057c22d70fcff816e297c94df57e02b25 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Mon, 6 Nov 2023 09:26:21 -0700 Subject: [PATCH 6/9] Hide most output when running prettier --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 26fe03fa6e1c..77e91a9ac752 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "lint-changed": "eslint --fix $(git diff --diff-filter=AM --name-only main -- \"*.js\" \"*.ts\" \"*.tsx\")", "lint-watch": "npx eslint-watch --watch --changed", "shellcheck": "./scripts/shellCheck.sh", - "prettier": "prettier --write .", + "prettier": "prettier --write . --loglevel warn", "prettier-watch": "onchange \"**/*.{js,ts,tsx}\" -- prettier --write --ignore-unknown {{changed}}", "print-version": "echo $npm_package_version", "storybook": "start-storybook -p 6006", From 31ec9334a3cc15e4b469856e794f04b57eb7e93a Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Mon, 6 Nov 2023 09:44:06 -0700 Subject: [PATCH 7/9] Remove a duplicate withOnyx --- .../MoneyRequestParticipantsPage.js | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js index 8302564cfcb7..a751158714c0 100644 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js @@ -9,7 +9,6 @@ import ScreenWrapper from '@components/ScreenWrapper'; import transactionPropTypes from '@components/transactionPropTypes'; import useInitialValue from '@hooks/useInitialValue'; import useLocalize from '@hooks/useLocalize'; -import compose from '@libs/compose'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import * as MoneyRequestUtils from '@libs/MoneyRequestUtils'; import Navigation from '@libs/Navigation/Navigation'; @@ -155,19 +154,14 @@ MoneyRequestParticipantsPage.displayName = 'MoneyRequestParticipantsPage'; MoneyRequestParticipantsPage.propTypes = propTypes; MoneyRequestParticipantsPage.defaultProps = defaultProps; -export default compose( - withOnyx({ - iou: { - key: ONYXKEYS.IOU, - }, - selectedTab: { - key: `${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.RECEIPT_TAB_ID}`, - }, - }), - // eslint-disable-next-line rulesdir/no-multiple-onyx-in-file - withOnyx({ - transaction: { - key: ({iou}) => `${ONYXKEYS.COLLECTION.TRANSACTION}${iou.transactionID}`, - }, - }), -)(MoneyRequestParticipantsPage); +export default withOnyx({ + iou: { + key: ONYXKEYS.IOU, + }, + selectedTab: { + key: `${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.RECEIPT_TAB_ID}`, + }, + transaction: { + key: ({iou}) => `${ONYXKEYS.COLLECTION.TRANSACTION}${lodashGet(iou, 'transactionID', 0)}`, + }, +})(MoneyRequestParticipantsPage); From 0431e48efe2fbc3f1a1f561522c8e45198ef4e28 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Mon, 6 Nov 2023 10:05:15 -0700 Subject: [PATCH 8/9] Remove unused import --- src/pages/EditRequestPage.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/EditRequestPage.js b/src/pages/EditRequestPage.js index b9557b109651..2df84383003b 100644 --- a/src/pages/EditRequestPage.js +++ b/src/pages/EditRequestPage.js @@ -8,7 +8,6 @@ import categoryPropTypes from '@components/categoryPropTypes'; import ScreenWrapper from '@components/ScreenWrapper'; import tagPropTypes from '@components/tagPropTypes'; import transactionPropTypes from '@components/transactionPropTypes'; -import compose from '@libs/compose'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import Navigation from '@libs/Navigation/Navigation'; import * as OptionsListUtils from '@libs/OptionsListUtils'; From 346e6b62e5fe48078bd8266e5648e4e9bb9bd78d Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Thu, 9 Nov 2023 10:13:45 -0700 Subject: [PATCH 9/9] Return 0 instead of an empty string --- src/libs/actions/IOU.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index acdbc200842b..8c34787f13f0 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -2949,7 +2949,7 @@ function navigateToNextPage(iou, iouType, report, path = '') { * @returns {String} */ function getIOUReportID(iou, route) { - return lodashGet(route, 'params.reportID') || lodashGet(iou, 'participants.0.reportID', ''); + return lodashGet(route, 'params.reportID') || lodashGet(iou, 'participants.0.reportID', '0'); } export {