Skip to content

Commit f4b2d50

Browse files
authored
Merge pull request #79279 from parasharrajat/66514-3
[Part 3] Remove Onyx.connect() for the key: ONYXKEYS.COLLECTION.NEXT_STEP in src/libs/actions/IOU.ts
2 parents 38b403f + f5b0209 commit f4b2d50

22 files changed

+262
-104
lines changed

src/components/ReportActionItem/MoneyRequestView.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ function MoneyRequestView({
177177
// When this component is used when merging from the search page, we might not have the parent report stored in the main collection
178178
let [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${parentReportID}`, {canBeMissing: true});
179179
parentReport = parentReport ?? currentSearchResults?.data[`${ONYXKEYS.COLLECTION.REPORT}${parentReportID}`];
180+
const [parentReportNextStep] = useOnyx(`${ONYXKEYS.COLLECTION.NEXT_STEP}${getNonEmptyStringOnyxID(parentReport?.reportID)}`, {canBeMissing: true});
180181

181182
const parentReportActionSelector = (reportActions: OnyxEntry<OnyxTypes.ReportActions>) =>
182183
transactionThreadReport?.parentReportActionID ? reportActions?.[transactionThreadReport.parentReportActionID] : undefined;
@@ -444,37 +445,39 @@ function MoneyRequestView({
444445
if (newBillable === getBillable(transaction) || !transaction?.transactionID || !transactionThreadReport?.reportID) {
445446
return;
446447
}
447-
updateMoneyRequestBillable(
448-
transaction.transactionID,
448+
updateMoneyRequestBillable({
449+
transactionID: transaction.transactionID,
449450
transactionThreadReport,
450451
parentReport,
451-
newBillable,
452+
value: newBillable,
452453
policy,
453454
policyTagList,
454455
policyCategories,
455456
currentUserAccountIDParam,
456457
currentUserEmailParam,
457458
isASAPSubmitBetaEnabled,
458-
);
459+
parentReportNextStep,
460+
});
459461
};
460462

461463
const saveReimbursable = (newReimbursable: boolean) => {
462464
// If the value hasn't changed, don't request to save changes on the server and just close the modal
463465
if (newReimbursable === getReimbursable(transaction) || !transaction?.transactionID || !transactionThreadReport?.reportID) {
464466
return;
465467
}
466-
updateMoneyRequestReimbursable(
467-
transaction.transactionID,
468+
updateMoneyRequestReimbursable({
469+
transactionID: transaction.transactionID,
468470
transactionThreadReport,
469471
parentReport,
470-
newReimbursable,
472+
value: newReimbursable,
471473
policy,
472474
policyTagList,
473475
policyCategories,
474476
currentUserAccountIDParam,
475477
currentUserEmailParam,
476478
isASAPSubmitBetaEnabled,
477-
);
479+
parentReportNextStep,
480+
});
478481
};
479482

480483
if (isManagedCardTransaction) {

src/hooks/useDeleteTransactions.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function useDeleteTransactions({report, reportActions, policy}: UseDeleteTransac
3636
const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, {canBeMissing: true});
3737
const [policyRecentlyUsedCurrencies] = useOnyx(ONYXKEYS.RECENTLY_USED_CURRENCIES, {canBeMissing: true});
3838
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, {canBeMissing: true});
39+
const [iouReportNextStep] = useOnyx(`${ONYXKEYS.COLLECTION.NEXT_STEP}${getNonEmptyStringOnyxID(report?.reportID)}`, {canBeMissing: true});
3940

4041
const {isBetaEnabled} = usePermissions();
4142
const archivedReportsIdSet = useArchivedReportsIdSet();
@@ -149,6 +150,7 @@ function useDeleteTransactions({report, reportActions, policy}: UseDeleteTransac
149150
transactionViolations,
150151
policyRecentlyUsedCurrencies: policyRecentlyUsedCurrencies ?? [],
151152
quickAction,
153+
iouReportNextStep,
152154
});
153155
}
154156

@@ -184,20 +186,21 @@ function useDeleteTransactions({report, reportActions, policy}: UseDeleteTransac
184186
return Array.from(deletedTransactionThreadReportIDs);
185187
},
186188
[
187-
reportActions,
188-
allTransactions,
189-
allReports,
190-
report,
191189
allPolicyRecentlyUsedCategories,
192190
allReportNameValuePairs,
193-
policyCategories,
194-
policy,
195-
isBetaEnabled,
191+
allReports,
192+
allTransactions,
193+
archivedReportsIdSet,
196194
currentUserPersonalDetails,
197-
transactionViolations,
195+
iouReportNextStep,
196+
isBetaEnabled,
197+
policy,
198+
policyCategories,
198199
policyRecentlyUsedCurrencies,
199200
quickAction,
200-
archivedReportsIdSet,
201+
report,
202+
reportActions,
203+
transactionViolations,
201204
],
202205
);
203206

0 commit comments

Comments
 (0)