Skip to content

Remove getReportTransactions from getUpdateMoneyRequestParams: library change and save-time callers (Part 13A) - #104814

Draft
linhvovan29546 wants to merge 8 commits into
Expensify:mainfrom
linhvovan29546:refactor/66418-remove-getReportTransactions-p13
Draft

linhvovan29546 wants to merge 8 commits into
Expensify:mainfrom
linhvovan29546:refactor/66418-remove-getReportTransactions-p13

Conversation

@linhvovan29546

@linhvovan29546 linhvovan29546 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Part 13A of the effort to remove the deprecated, Onyx.connect-backed getReportTransactions global (#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, getUpdateMoneyRequestParams in UpdateMoneyRequest.ts recomputes whether the IOU report still has submission-blocking violations. To do that it called getReportTransactions(moneyRequestReport?.reportID) to get the report's other expenses. This PR passes those transactions in instead:

  • getUpdateMoneyRequestParams and the 13 updateMoneyRequest* wrappers take an optional iouReportTransactions param 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.
  • New pure helper getReportTransactionsFromDerivedValue picks a report's transactions out of the REPORT_TRANSACTIONS_AND_VIOLATIONS derived value, which is already grouped by reportID, so it is a key lookup instead of a scan of every transaction.
  • Callers in this PR read the derived value at save time, inside the Onyx.multiGet their handler already runs, instead of subscribing with useReportTransactions. That avoids re-rendering the page on every transaction change (see [$1500] Expose Onyx.get #101910):
    • Edit pages: DynamicIOURequestStepAttendees, Date, Description, DistanceManual, DistanceRate, Merchant, TaxAmountPage and IOURequestStepDistanceOdometer.
    • Inline editing: useTransactionInlineEdit reads it in getEditParams and passes it via a new parentReportTransactions field on TransactionInlineEditParams.
    • Split: updateSplitTransactions takes the derived value as a new reportTransactionsAndViolations field (read in DynamicSplitExpensePage's save handler, and already subscribed in useDeleteTransactions) and uses it instead of filtering allTransactionsList once per split.
  • Removes the @typescript-eslint/no-deprecated/getReportTransactions row for UpdateMoneyRequest.ts from the seatbelt.
  • Tests: the affected calls pass iouReportTransactions: [] (or parentReportTransactions: [], 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. getUpdateMoneyRequestParams also calls getUpdatedMoneyRequestReportData, which reaches recalculateOptimisticReportName (formula report titles) in MoneyRequestBuilder.ts. That still uses getReportTransactions and will be converted in a follow-up.

No user-facing behavior change is intended.

Fixed Issues

$ #66418
PROPOSAL: N/A

Tests

  1. Sign in with a workspace account where categories are required. Create an expense report with 2 expenses, one of them without a category (it shows a "Missing category" violation).
  2. On the other expense, edit each of these fields in turn and verify each change saves and the report total/violations stay correct: Amount, Merchant, Date, Description, Tax amount, Attendees.
  3. Create a distance expense on the report and edit its Distance (manual and odometer) and Rate. Verify each change saves.
  4. Go to Reports, open the report in the table view and edit an expense's merchant, date, amount, category and description inline. Verify each change saves. On the expense with the "Missing category" violation, set a category inline and verify the violation clears and the report no longer shows it needs fixing.
  5. Split an expense, then edit the split amounts and save. Verify the split expenses update, then delete one split and verify the report updates.
  • Verify that no errors appear in the JS console

Offline tests

Same as test

QA Steps

Same as test

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

🤖 Generated with Claude Code

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.
@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/hooks/useDeleteTransactions.ts 73.03% <100.00%> (+0.15%) ⬆️
src/hooks/useTransactionInlineEdit.ts 100.00% <100.00%> (ø)
src/libs/actions/IOU/SplitTransactionUpdate.ts 73.37% <ø> (-19.15%) ⬇️
src/libs/actions/IOU/UpdateMoneyRequest.ts 93.61% <100.00%> (-0.21%) ⬇️
src/libs/actions/TransactionInlineEdit.ts 97.16% <ø> (ø)
src/libs/getReportTransactionsFromDerivedValue.ts 100.00% <100.00%> (ø)
src/pages/iou/DynamicSplitExpensePage.tsx 69.28% <0.00%> (ø)
...ou/request/step/DynamicIOURequestStepAttendees.tsx 0.00% <0.00%> (ø)
...ges/iou/request/step/DynamicIOURequestStepDate.tsx 0.00% <0.00%> (ø)
.../request/step/DynamicIOURequestStepDescription.tsx 88.78% <0.00%> (-0.84%) ⬇️
... and 5 more
... and 7432 files with indirect coverage changes

…-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.
@linhvovan29546 linhvovan29546 changed the title Remove getReportTransactions callers' reliance on the deprecated default in getUpdateMoneyRequestParams (Part 13) Remove getReportTransactions from getUpdateMoneyRequestParams: library change and save-time callers (Part 13A) Dec 2, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant