You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Refactor] Split IOURequestStepConfirmation, MoneyRequestConfirmationList, and useExpenseSubmission per expense type #99449
The confirmation step is implemented as one component, IOURequestStepConfirmation (~1050 lines), rendering one list component, MoneyRequestConfirmationList (693 lines), and submitting through one hook, useExpenseSubmission (1229 lines).
These three units serve nine expense types (manual, scan, per-diem, time, and five distance variants) across six flows (submit, track, split, invoice, pay, and the new-manual-expense-flow beta). Type- and flow-specific behavior is selected at runtime through boolean flags: the list component alone carries 55 type/flow conditionals (isPerDiemRequest, isOdometerDistanceRequest, isTypeInvoice, …), and the page passes those flags down through props.
The useExpenseSubmission hook subscribes to ~29 Onyx keys to feed seven distinct API submit paths (RequestMoney, TrackExpense, CreateDistanceRequest, CreatePerDiemRequest, three split commands, SendInvoice, SendMoney), of which any given submission uses exactly one. In total a confirmation mount establishes ~65 Onyx subscriptions and runs the effects of every expense type, including hooks for types not in use.
Problem
When different expense types share one confirmation component, one list, and one submission hook wired together by boolean flags, opening the confirmation screen for any expense pays the subscriptions and effects of all nine types on the final step of every submission. The same sharing means any change to one type's confirmation behavior executes inside every other type's flow — regressing unrelated submissions and making every change slower and riskier to review.
Plan (bottom-up)
Following review feedback, we'll start at the leaves and work up the tree, so each step is an improvement on its own and lower-level components are decomposed before the pages that compose them:
Fork MoneyRequestConfirmationListFooter per type — InvoiceFooter, ScanFooter, etc. (it already has some sections decomposed). MoneyRequestConfirmationListFooter.tsx stays as a dispatcher for now.
Split MoneyRequestConfirmationList (already decomposed into sections/controllers), reusing the per-flow footers created in step 1.
Split useExpenseSubmission.ts into a shared core plus one hook per API path, each owning only the Onyx subscriptions its call reads.
Fork IOURequestStepConfirmation.tsx into an index.tsx dispatcher plus per-type variants, composing the forks and submission hooks from the previous steps.
Each fork may not be fully decomposed initially, but every step is a net improvement over what we have today. A POC of one flow fork will be shared first to validate the approach. Reviews welcome from @roryabraham given his decomposition context.
Update:
I've started my work on turning MoneyRequestConfirmationListFooter into a dispatcher with per-type forks:
Turned MoneyRequestConfirmationListFooter into a dispatcher
Extracted first footer (PerDiemFooter), the rest is stored in Default as if now, and it will be cut off as new footers are extracted.
Right now, working on moving type-specific fields data out of ConfirmationFieldList, mostly relatest to TransactionDetailsFields block (it has condition rendering of AmountField, DistanceField, TimeFields)
distance controller + state, commuter guard, receipt training
Layer 3
Page variants are keyed on the submission path, not on iouType. One variant per API command, so each composes exactly one submission hook by construction.
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.34-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
Why the work exceeded the issue:
The PRs rework the confirmation step that every expense submission runs through.
For each PR (except unit tests), I ran a full regression pass across every submission path.
Regressions caused by this PR: None. The blockers linked to this issue (#102484, #103271, #103352) were caused by #101301 and #102258 (not our PRs).
Core flow changes: Expense confirmation and submission for manual, scan, per diem, time and distance expenses, across submit, track, split, invoice and pay
Total: $250 (I was assigned on Aug 31) x 10 = $2500
Activity
VickyStash commentedon Aug 26, 2026
Update:
I've started my work on turning
MoneyRequestConfirmationListFooterinto a dispatcher with per-type forks:MoneyRequestConfirmationListFooterinto a dispatcherPerDiemFooter), the rest is stored in Default as if now, and it will be cut off as new footers are extracted.WIP updates can be found in #99578
VickyStash commentedon Aug 27, 2026
Updates:
TransactionDetailsFieldsto be type-specificConfirmationFieldsProviderup (have one test failing which I need to check)So PR 1 will have:
MoneyRequestConfirmationListFooterforking setupPerDiemFooterandTimeFooterThis way it's easier to evaluate the structure before we move forward with other footers.
TODOs for PR 1:
PR draft: #99578
VickyStash commentedon Aug 27, 2026
Also, here the high level of new structure:
High level new structure description
Layer 1
PerDiemFooterTimeFooterDistanceMapFooterdistance,distance-map,distance-gpsDistanceManualFooterDistanceOdometerFooterScanFooterManualFooterLayer 2
Each list variant renders exactly one footer variant, and mounts only the controllers its expense type needs.
PerDiemConfirmationListPerDiemFooteruseTaxAmount, commuter guardTimeConfirmationListTimeFooterDistanceMapConfirmationListDistanceMapFooteruseDistanceRequestState+DistanceRequestController,TaxControllerDistanceManualConfirmationListDistanceManualFooteruseCommuterExclusionGuardDistanceOdometerConfirmationListDistanceOdometerFooterScanConfirmationListScanFooteruseReceiptTraining,TaxControllerManualConfirmationListManualFooterTaxController,FieldAutoSelectorLayer 3
Page variants are keyed on the submission path, not on
iouType. One variant per API command, so each composes exactly one submission hook by construction.DistanceConfirmationCreateDistanceRequestuseDistanceSubmissionSplitConfirmationuseSplitSubmissionInvoiceConfirmationSendInvoiceuseInvoiceSubmissionTrackConfirmationTrackExpenseuseTrackExpenseSubmissionPerDiemConfirmationCreatePerDiemExpenseusePerDiemSubmissionRequestMoneyConfirmationRequestMoneyuseRequestMoneySubmissionPayConfirmationSendMoneyuseSendMoneySubmissionPage examples:
VickyStash commentedon Aug 28, 2026
First PR is open for review: #99578
VickyStash commentedon Aug 31, 2026
UPD:
105 remaining items
melvin-bot commentedon Nov 9, 2026
@situchan
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.34-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
situchan commentedon Nov 11, 2026
Not overdue
VickyStash commentedon Nov 12, 2026
The last PR here was deployed to prod 2 days ago, I think we can move forward here after the 7-day regression period
situchan commentedon Nov 17, 2026
@VickyStash this project is done right?
VickyStash commentedon Nov 17, 2026
@situchan Yes, I think so
situchan commentedon Nov 17, 2026
@MelvinBot list all PRs linked to this issue
MelvinBot commentedon Nov 17, 2026
Found 11 PRs linked through this issue’s comments or cross-references:
Total: 10 merged, 1 closed without merging, none open.
view run
situchan commentedon Nov 17, 2026
Why the work exceeded the issue:
The PRs rework the confirmation step that every expense submission runs through.
For each PR (except unit tests), I ran a full regression pass across every submission path.
Regressions caused by this PR: None. The blockers linked to this issue (#102484, #103271, #103352) were caused by #101301 and #102258 (not our PRs).
Core flow changes: Expense confirmation and submission for manual, scan, per diem, time and distance expenses, across submit, track, split, invoice and pay
Total: $250 (I was assigned on Aug 31) x 10 = $2500
cc: @mountiny