Repository navigation
Remove getReportTransactions from getUpdateMoneyRequestParams: library change and save-time callers (Part 13A) - #104814
Draft
linhvovan29546 wants to merge 8 commits into
Conversation
Require callers to pass the IOU report's transactions, used to recompute the report's submission-blocking violations after an edit, instead of reading them from the deprecated Onyx.connect-backed global. Thread them through the 13 updateMoneyRequest* wrappers, inline editing, amount submission, merge and split, and the edit pages, which read them with useReportTransactions.
…-getReportTransactions-p13 # Conflicts: # config/oxlint/oxlint.seatbelt.tsv # src/hooks/useUpdateTransactionCategory.ts # src/pages/TransactionMerge/DynamicConfirmationPage.tsx # src/pages/iou/request/step/DynamicIOURequestStepAttendees.tsx # src/pages/iou/request/step/DynamicIOURequestStepCategoryCreate.tsx # src/pages/iou/request/step/DynamicIOURequestStepDistance.tsx # src/pages/iou/request/step/DynamicIOURequestStepTag.tsx # src/pages/iou/request/step/DynamicIOURequestStepTaxAmountPage.tsx # src/pages/iou/request/step/DynamicIOURequestStepTaxRatePage.tsx # tests/actions/IOUTest/UpdateMoneyRequestTest.ts
Read the REPORT_TRANSACTIONS_AND_VIOLATIONS derived value in the existing Onyx.multiGet of each save handler and inline edit, instead of subscribing with useReportTransactions.
Pass the REPORT_TRANSACTIONS_AND_VIOLATIONS derived value so the report's transactions are a key lookup instead of a scan of every transaction per split.
… iouReportTransactions optional
38 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
Part 13A of the effort to remove the deprecated,
Onyx.connect-backedgetReportTransactionsglobal (#66418). Part 13 is split in two to keep the diff reviewable: this PR is the library change plus the callers that already read Onyx at save time. Part 13B migrates the remaining callers and makes the param required.After an expense is edited,
getUpdateMoneyRequestParamsinUpdateMoneyRequest.tsrecomputes whether the IOU report still has submission-blocking violations. To do that it calledgetReportTransactions(moneyRequestReport?.reportID)to get the report's other expenses. This PR passes those transactions in instead:getUpdateMoneyRequestParamsand the 13updateMoneyRequest*wrappers take an optionaliouReportTransactionsparam and use it in place of the global lookup. It is optional here so the callers in 13B can migrate separately, and 13B makes it required.getReportTransactionsFromDerivedValuepicks a report's transactions out of theREPORT_TRANSACTIONS_AND_VIOLATIONSderived value, which is already grouped by reportID, so it is a key lookup instead of a scan of every transaction.Onyx.multiGettheir handler already runs, instead of subscribing withuseReportTransactions. That avoids re-rendering the page on every transaction change (see [$1500] Expose Onyx.get #101910):DynamicIOURequestStepAttendees,Date,Description,DistanceManual,DistanceRate,Merchant,TaxAmountPageandIOURequestStepDistanceOdometer.useTransactionInlineEditreads it ingetEditParamsand passes it via a newparentReportTransactionsfield onTransactionInlineEditParams.updateSplitTransactionstakes the derived value as a newreportTransactionsAndViolationsfield (read inDynamicSplitExpensePage's save handler, and already subscribed inuseDeleteTransactions) and uses it instead of filteringallTransactionsListonce per split.@typescript-eslint/no-deprecated/getReportTransactionsrow forUpdateMoneyRequest.tsfrom the seatbelt.iouReportTransactions: [](orparentReportTransactions: [],reportTransactionsAndViolations: undefined). In all but one test the old list held only the edited expense, which this code removes and replaces with its updated version anyway, so the result is identical. The one real case (the distance "edge cases" test, whose report holds 2 expenses) now reads the report's transactions from Onyx.Not in this PR: the callers that subscribe instead of reading at save time (
MoneyRequestView, the category/tag/tax-rate hooks, the merge page, the amount step and the map distance page) are in 13B.getUpdateMoneyRequestParamsalso callsgetUpdatedMoneyRequestReportData, which reachesrecalculateOptimisticReportName(formula report titles) inMoneyRequestBuilder.ts. That still usesgetReportTransactionsand will be converted in a follow-up.No user-facing behavior change is intended.
Fixed Issues
$ #66418
PROPOSAL: N/A
Tests
Offline tests
Same as test
QA Steps
Same as test
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
🤖 Generated with Claude Code