refactor: extract the transaction data derivation chain - #100039
Draft
sosek108 wants to merge 9 commits into
Draft
refactor: extract the transaction data derivation chain#100039sosek108 wants to merge 9 commits into
sosek108 wants to merge 9 commits into
Conversation
40 tasks
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
This is PR 9 of a 10-PR stack decomposing the MoneyRequestReport list components (
MoneyRequestReportActionsList/MoneyRequestReportTransactionList) into focused hooks and presentational sub-components (issue #99919, superseding drafts #99307 and #99417).This slice extracts the transaction data derivation chain into dedicated hooks:
src/components/MoneyRequestReportView/useMoneyRequestReportSortedTransactions.ts— owns the table's sort state (sortBy/sortOrder,onSortPress) and derives the sorted/resolved transaction arrays plus the per-transaction lookup maps the rows consume: the report-action single-pass map (transaction-thread report IDs), the RBR-first default sort, card-field resolution, highlighted-transaction IDs, and the filtered violations map with its stableEMPTY_VIOLATIONSreference.src/components/MoneyRequestReportView/useMoneyRequestReportGroupedTransactions.ts— derives the grouped/flattened list-item arrays from the sorted transactions and the current group-by mode:groupedTransactions, the flatlistItemsrender array,visualOrderTransactionIDs, andlastTransactionID.src/components/MoneyRequestReportView/useMoneyRequestReportActiveTransactionIDs.ts— the effect that seeds the transaction-thread carousel with the visually-ordered transaction IDs when the report is open in the super-wide RHP, and clears them on unmount.src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx— consumes the three hooks in place of the inline sort/group/carousel blocks and drops the locals/imports that moved with them (sort state, RBR set, card list/violations/owner-login Onyx reads, grouping memos, the carousel effect). TheTransactionWithOptionalHighlight/TransactionListItemDatatypes are now re-exported from the hooks. Selection and pending-expense logic stay inline until the final slice.Pure refactor — no behavior change.
Stack note: this PR is stacked on #100037 (
decompose/money-request-report-transactions-b2), which is stacked on #100036, #100035, #100033, #100030, #100025, #100024 and #100023. Until those PRs merge, the diff here also shows their commits. Only the "Extract the transaction data derivation chain" commit belongs to this slice.Fixed Issues
$ #99919
PROPOSAL:
Tests
npx jest tests/ui/MoneyRequestReportActionsListRejectModalTest.tsxand verify it passesOffline tests
QA Steps
Same as Tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))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