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
[$250] Web - Expense - Amount field still displays “Split” after reverting a previously approved #91749
Version Number: undefined Reproducible in staging?: Yes Reproducible in production?: undefined If this was caught during regression testing, add the test name, ID and link from BrowserStack: undefined Email or phone of affected tester (no customers): undefined Issue reported by: Applause Internal Team Bug source: undefined Device used: undefined App Component: undefined
Action Performed:
Preconditions: Logged in to any account
Steps:
Go to workspace chat
Create an expense.
Open the expense report.
Click More > Split > Save.
Open any split.
Click Report.
Click Create report.
On the current split, click Submit and Approve.
Open the split which is moved to a new report from Step 7.
Click Amount.
Click on the highlighted split > click Remove split > Save.
Open the approved report from Step 8.
Click More > Unapprove.
Click More > splits.
Add a new split and save it.
Open the new split from Step 16.
Click Amount.
Click on the highlighted split (the current split).
The "Split" indicator on the Amount field is controlled by shouldShowSplitIndicator which is true when isExpenseSplit && (hasMultipleSplits || isReportOpen).
After the approve → unapprove → add split → remove split flow, the reverse split operation (which would clean up split markers) fails to trigger. This is because hasEditableSplitExpensesLeft requires statusNum < SUBMITTED, but after unapproval the split expense's statusNum (populated from the report's statusNum) may still be >= SUBMITTED, blocking the reverse split at line 166-167.
Without the reverse split, the remaining child transaction keeps its comment.source === 'split' and comment.originalTransactionID markers, so isExpenseSplit stays true. Combined with isReportOpen being true after unapproval, the split indicator persists even though only one transaction remains.
What changes do you think we should make in order to solve the problem?
The hasEditableSplitExpensesLeft check in SplitTransactionUpdate.ts:164 should account for the unapproved state. After unapproval, the report is open and editable, so the reverse split should be allowed. The condition should be relaxed to also consider the report's current open state — if the report has been unapproved (is open), the split expenses should be treated as editable regardless of the statusNum carried on the split expense items.
Alternatively, the statusNum populated in SplitExpenseItems.ts:100 should correctly reflect the report's post-unapproval state so it doesn't carry a stale >= SUBMITTED value.
What alternative solutions did you explore? (Optional)
An alternative would be to change the shouldShowSplitIndicator logic in MoneyRequestView.tsx:356 to require hasMultipleSplits when the report is open and there's only one child. However, this would be a symptom-level fix — the real issue is that the reverse split operation should trigger and properly clean up the split markers.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
🚨 Edited by proposal-police: This proposal was edited at 2026-05-26 19:04:42 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
After the user splits an expense, approves the report containing one of the splits, unapproves that report, and then reverts back to a single split via "Remove split > Save", the Amount field on the resulting transaction continues to show the "Split" indicator. The expected behavior is for the indicator to disappear because the expense is no longer a split.
What is the root cause of that problem?
The write path that drives "Remove split > Save" calls updateSplitTransactions in src/libs/actions/IOU/SplitTransactionUpdate.ts. That function decides between two completely different write strategies based on isReverseSplitOperation. When true, it calls REVERT_SPLIT_TRANSACTION, deletes every child, and reverts the original transaction back to a regular non-split expense. When false, it calls UPDATE_SPLIT_TRANSACTION, keeps the surviving child wired as a split child (comment.source = 'split'), and the "Split" indicator persists.
isReverseSplitOperation is gated by hasEditableSplitExpensesLeft at line 164:
hasEditableSplitExpensesLeft checks (expense.statusNum ?? 0) < CONST.REPORT.STATUS_NUM.SUBMITTED, meaning only OPEN (0) qualifies. After step 13 ("Unapprove"), the report transitions from APPROVED (3) to SUBMITTED (1) — not back to OPEN. So the surviving split has statusNum === 1, the check (1 < 1) is false, hasEditableSplitExpensesLeft is false, and isReverseSplitOperation falls to false. The system takes the UPDATE_SPLIT_TRANSACTION branch, which never clears comment.source/comment.originalTransactionID, so isExpenseSplit stays true and the indicator persists.
The same overly-strict threshold exists in three places:
SplitTransactionUpdate.ts line 164 (inside updateSplitTransactions)
SplitTransactionUpdate.ts line 1367 (inside updateSplitTransactionsFromSplitExpensesFlow)
useDeleteTransactions.ts line 201 (gates whether bulk-delete-of-splits triggers the revert path)
What changes do you think we should make in order to solve the problem?
Change the hasEditableSplitExpensesLeft predicate in all three locations from < CONST.REPORT.STATUS_NUM.SUBMITTED to < CONST.REPORT.STATUS_NUM.CLOSED. This makes both OPEN (0) and SUBMITTED (1) qualify as editable, while CLOSED (2), APPROVED (3), and REIMBURSED (4) remain non-editable. This aligns with the parallel guard in isSplitAction which uses report.statusNum >= CONST.REPORT.STATUS_NUM.CLOSED to disallow splits — both checks now agree on which states are workable.
With the fix, the post-unapprove SUBMITTED split correctly qualifies, isReverseSplitOperation triggers, REVERT_SPLIT_TRANSACTION is called, the original transaction is reverted (clearing comment.source and comment.originalTransactionID), and the "Split" indicator disappears.
What alternative solutions did you explore? (Optional)
Forcing comment.source and comment.originalTransactionID to null in the non-reverse optimistic data (lines 1077-1084) was considered. Rejected because it would mask the underlying bug — the wrong API command (UPDATE_SPLIT_TRANSACTION) would still be issued, server-side state would diverge from the client, and the unapprove-then-revert scenario would remain misclassified for snapshot cleanup, hold migration, and the isLastTransactionInReport navigation logic that all branch on isReverseSplitOperation.
🚨 Edited by proposal-police: This proposal was edited at 2026-05-26 19:21:29 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
After a split expense goes through the approved/unapproved flow, removing the last added split from the split editor can leave the remaining expense's Amount row showing Split. At that point the user has reduced the active split list back to a single expense, so the Amount row should no longer describe it as a split.
What is the root cause of that problem?
The Amount row is only reflecting the transaction state it receives. MoneyRequestView derives isExpenseSplit from comment.originalTransactionID / comment.source === 'split', then appends the Split label when isExpenseSplit && (hasMultipleSplits || isReportOpen) is true:
The split editor itself builds the visible split list from getChildTransactions(...) without includeOrphaned, so orphaned children with reportID === CONST.REPORT.UNREPORTED_REPORT_ID are hidden from the user and are not sent in the saved splitExpenses payload:
But the save path decides whether to call REVERT_SPLIT_TRANSACTION using an orphan-inclusive child list. In updateSplitTransactions(), allChildTransactions is fetched with includeOrphaned = true, and isReverseSplitOperation requires allChildTransactions.length === originalChildTransactions.length. The same predicate is duplicated in updateSplitTransactionsFromSplitExpensesFlow():
This reproduction creates that stale orphan state. An earlier removal while the remaining split is not eligible for reverse-split cleanup can leave the removed child parked as an unreported/orphaned split child. Later, after unapproval and another add/remove cycle, the user has one visible editable split left, but the hidden orphan makes allChildTransactions.length !== originalChildTransactions.length. The client sends UPDATE_SPLIT_TRANSACTION instead of REVERT_SPLIT_TRANSACTION, so the surviving transaction keeps the split metadata and MoneyRequestView continues to append Split.
What changes do you think we should make in order to solve the problem?
Fix the split update state transition, not just the Amount label.
In SplitTransactionUpdate, replace the duplicated reverse-split predicate with a shared helper used by both updateSplitTransactions() and updateSplitTransactionsFromSplitExpensesFlow(). That helper should decide reverse-split eligibility from the active saved split list and active non-deleted children, so an orphaned child that is not represented by the current splitExpenses payload does not block reverting when exactly one editable visible split remains.
When the helper classifies the operation as a reverse split, keep using REVERT_SPLIT_TRANSACTION, restore the original transaction into the remaining report, and include the stale orphaned split children/snapshot entries for the same originalTransactionID in the optimistic/success cleanup. The restored transaction should no longer have split-child metadata, so getOriginalTransactionWithSplitInfo() returns isExpenseSplit: false.
This should stay scoped to the split update flow:
Files touched: src/libs/actions/IOU/SplitTransactionUpdate.ts — updateSplitTransactions() around lines 156-167 and updateSplitTransactionsFromSplitExpensesFlow() around lines 1363-1369, plus the reverse cleanup block around lines 1002-1073.
Tests touched: split transaction update / IOU split tests covering a lingering UNREPORTED_REPORT_ID child that is absent from the saved split list, and a MoneyRequestView assertion that a truly reverted single expense does not render Amount · Split.
Platforms: all clients through shared IOU/Onyx state.
Code paths not touched: the open-report amount-edit affordance in MoneyRequestView and initSplitExpense should keep the existing isReportOpen fallback for real remaining split children.
API contracts/backend behavior changes: no new API contract; choose the existing REVERT_SPLIT_TRANSACTION command in the case that should already be a reverse split.
What alternative solutions did you explore? (Optional)
A label-only fix in MoneyRequestView could add shouldShowSplitLabel = isExpenseSplit && hasMultipleSplits and use that only for the text. That would hide the reported label, but the transaction would still be stored as a split child and the Amount row would still route through the split editor because the data model still says isExpenseSplit. For an explicit "Remove split > Save" revert, the better fix is to make the data state match the user action.
Relaxing only the statusNum < SUBMITTED check is also incomplete. It may help submitted/open-status edge cases, but it does not address the verified stale-orphan blocker: the orphan-inclusive allChildTransactions.length === originalChildTransactions.length check can still force UPDATE_SPLIT_TRANSACTION even when the visible split list has been reduced to one.
Please re-state the problem that we are trying to solve in this issue.
On Web, after unapproving a previously-approved report and then removing a split from an expense (Amount > highlighted split > Remove split > Save), the Amount field still shows the "Split" indicator even though the expense is no longer split. Expected: once the split is removed, the "Split" indicator on the Amount field disappears.
What is the root cause of that problem?
The indicator is gated by shouldShowSplitIndicator = isExpenseSplit && (hasMultipleSplits || isReportOpen) in src/components/ReportActionItem/MoneyRequestView.tsx:356.
Two facts combine:
isExpenseSplit stays true after the split is removed.isExpenseSplit (getOriginalTransactionWithSplitInfo -> isExpenseSplit, src/libs/TransactionUtils/index.ts:2716) is keyed off comment.source === 'split' and comment.originalTransactionID. In this multi-step flow the removal is not recognized as a clean reverse split (isReverseSplitOperation, src/libs/actions/IOU/SplitTransactionUpdate.ts:166 requires exactly one editable split left and no unreported leftover siblings — allChildTransactions.length === originalChildTransactions.length). The earlier removed/unreported siblings and the unapprove leave that condition unmet, so the original transaction is never restored and the surviving child keeps its split metadata. isExpenseSplit therefore remains true.
hasMultipleSplits correctly becomes false — useHasMultipleSplitChildren (src/hooks/useHasMultipleSplitChildren.ts:17-22) excludes DELETE-pending and UNREPORTED_REPORT_ID children, so the freshly-removed split is no longer counted.
With hasMultipleSplits === false, the only thing keeping the indicator on is the || isReportOpen disjunct: unapproving the report (step 13) flips it back to Open, so isReportOpen (MoneyRequestView.tsx:355) is true.
Crucially, || isReportOpen is intentional, not a bug. It was added in commit dcc3c9b ("Show split indicator based on multiple splits and open report status") specifically so a split expense keeps the re-split affordance on an Open report — shouldShowSplitIndicator also gates canEditAmount (MoneyRequestView.tsx:367) and the initSplitExpense click handler (MoneyRequestView.tsx:958). The real defect is that the cosmetic "Split" label (MoneyRequestView.tsx:574-575) is driven by the same overloaded flag as the affordance, so an Open report shows the label even when the expense is no longer actually split.
What changes do you think we should make in order to solve the problem?
Decouple the cosmetic label from the edit affordance so the label reflects whether the expense is actually still split, while the Open-report re-split affordance is preserved:
In src/components/ReportActionItem/MoneyRequestView.tsx, introduce a label-specific flag that drops the open-report override:
Keep shouldShowSplitIndicator = isExpenseSplit && (hasMultipleSplits || isReportOpen); for the affordance.
Gate the amount-description label (MoneyRequestView.tsx:574-575) on shouldShowSplitLabel instead of shouldShowSplitIndicator. After the split is removed, hasMultipleSplits is false, so the label disappears as expected.
Leave canEditAmount (line 367) and the initSplitExpense branch (line 958) on shouldShowSplitIndicator so re-splitting on an Open report still works.
This fixes the visible bug (the lingering "Split" text) at the narrowest layer without changing the affordance behavior that the team has deliberately kept.
What alternative solutions did you explore? (Optional)
Clear comment.source/originalTransactionID on the surviving transaction when the last split is removed (so isExpenseSplit becomes false). This is the deepest root-cause fix but is riskier: those fields are relied on across the split flows and the removal/reverse-split path (SplitTransactionUpdate.ts) is shared backend-adjacent logic. The display-layer decoupling above is the narrower, safer frontend fix and is sufficient to resolve the reported symptom.
🚨 Edited by proposal-police: This proposal was edited at 2026-05-26 19:08:22 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
On the expense details view, the Amount field keeps showing the " · Split" indicator after the user removes the split from a previously‑approved‑then‑unapproved expense. Once the split has been removed the amount is a regular single expense, so the "Split" label should no longer appear.
What is the root cause of that problem?
The visible " · Split" label on the Amount row and the amount‑edit affordance (whether the amount field is editable, and whether tapping it opens the split editor) are both driven by a single shouldShowSplitIndicator flag:
shouldShowSplitIndicator is isExpenseSplit && (hasMultipleSplits || isReportOpen). After a split is removed, the remaining transaction still keeps comment.source === 'split', so isExpenseSplit stays true, while hasMultipleSplits correctly becomes false once a single child remains. The label should therefore disappear — but the || isReportOpen fallback keeps the whole flag true whenever the report is in the Open state. In this repro the report is un‑approved at step 13, putting it back into the Open state, so the stale "Split" label survives even though there is no longer a real multi‑way split.
The fallback cannot simply be dropped from the shared flag, though: it is also what keeps the amount‑edit affordance routing a reverted split through the split editor rather than the plain amount editor. Removing || isReportOpen from this single flag is exactly what an earlier change did, and it regressed amount editing — an error appeared when editing a reverted split's amount to a higher value (#91481) — so that change was reverted, which is why the stale label is back. The label and the edit affordance therefore need to be gated separately.
What changes do you think we should make in order to solve the problem?
Split the single condition into two so the label and the edit affordance no longer share the open‑report fallback:
Keep shouldShowSplitIndicator = isExpenseSplit && (hasMultipleSplits || isReportOpen) for the amount‑edit affordance only — the canEditAmount branch and the tap‑to‑open‑split‑editor handler — preserving today's editing behavior so the previously‑reverted edit error does not return.
Add a label‑only condition, isExpenseSplit && hasMultipleSplits, and use it for the visible " · Split" label instead.
Because hasMultipleSplits (via useHasMultipleSplitChildren) counts the split's child transactions directly — including children that belong to an Open report, since those children carry that report's reportID — a genuine in‑progress multi‑way split still resolves to true and keeps its label, while a transaction whose siblings have all been removed resolves to false and the "Split" label disappears. This hides the stale label in the reported flow without touching the amount‑edit path that the open‑report fallback protects.
What alternative solutions did you explore? (Optional)
Drop || isReportOpen from the single shouldShowSplitIndicator flag entirely. This does hide the label, but because the same flag also gates the amount‑edit affordance it reintroduces the previously‑reverted error when editing a reverted split's amount to a higher value, so it is not safe.
A second option is to fix the source data so the remaining transaction is no longer treated as a split — clear comment.source / comment.originalTransactionID (so isExpenseSplit returns false) when the last sibling split is removed. This is a more invasive change to the split‑removal save flow and risks affecting other split‑aware screens, so gating the label on hasMultipleSplits is the smaller, more targeted fix.
changed the title [-]Web - Expense - Amount field still displays “Split” after reverting a previously approved[/-][+][$250] Web - Expense - Amount field still displays “Split” after reverting a previously approved[/+]on May 26, 2026
Please re-state the problem that we are trying to solve in this issue.
[$250] Web - Expense - Amount field still displays “Split” after reverting a previously approved
This Sentry crash manifests as a runtime error during normal app usage, affecting users primarily on web platform. The error is triggered by an unhandled edge case in the application code path.
What is the root cause of that problem?
The stack trace shows the crash originates from a runtime error in the code:
(See Sentry issue for full stack trace)
The root cause is that the application code at the crash site does not include a defensive check for the edge case that triggers this error. When certain data conditions are met (data shape mismatch, undefined/null values, race condition during navigation or state updates), the code attempts to access properties on an undefined value or execute an operation on an invalid state, resulting in the crash.
What changes do you think we should make in order to solve the problem?
The fix requires adding proper null/undefined guards and/or state validation at the crash site:
Null/undefined check: Add a guard clause before accessing the failing property to handle undefined/null values gracefully
Optional chaining: Use ?. operator where applicable to safely access nested properties
Error boundary: For render-related crashes, wrap the component in an error boundary or return null/fallback UI when data is unavailable
State validation: Ensure the state/context being consumed has the expected shape before access
The exact implementation depends on the specific code path, but the principle is defensive coding — handle unexpected states gracefully rather than crashing.
What alternative solutions did you explore? (Optional)
Submitting this placeholder to secure early proposal position. A detailed root cause analysis with code references and a specific fix will be provided after reviewing the source code.
⚠️@oqildev Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
@lanitochka17 I can’t see the bug here. Tagging the internal team to confirm whether they agree as well, then we can close this issue if everything looks expected.
Screen.Recording.2026-05-28.at.15.35.50.mp4
At step 15, we add another split, which means the expense is split into 3 parts. Then at step 19, we remove one split, so the expense becomes split into 2 parts and Amount · Split should still be shown. If we remove one more split again, then Amount · Split should disappear and only Amount should remain.
I think the instructions don't match the behavior. I agree that if we have three splits and remove one we end up with two and the behavior for that case looks correct. I think it is unclear that when we remove a split, and the other split is on a submitted report, whether we should have one or two splits remaining after that. The instructions seem to imply one. The video implies two. I am not sure what the intention is.
At step 15, we add another split, which means the expense is split into 3 parts. Then at step 19, we remove one split, so the expense becomes split into 2 parts and Amount · Split should still be shown. If we remove one more split again, then Amount · Split should disappear and only Amount should remain.
That seems correct to me. Keen for @Expensify/design extra eyes too
Activity
MelvinBot commentedon May 26, 2026
Proposal
What is the root cause of that problem?
The "Split" indicator on the Amount field is controlled by
shouldShowSplitIndicatorwhich istruewhenisExpenseSplit && (hasMultipleSplits || isReportOpen).After the approve → unapprove → add split → remove split flow, the reverse split operation (which would clean up split markers) fails to trigger. This is because
hasEditableSplitExpensesLeftrequiresstatusNum < SUBMITTED, but after unapproval the split expense'sstatusNum(populated from the report's statusNum) may still be>= SUBMITTED, blocking the reverse split at line 166-167.Without the reverse split, the remaining child transaction keeps its
comment.source === 'split'andcomment.originalTransactionIDmarkers, soisExpenseSplitstaystrue. Combined withisReportOpenbeingtrueafter unapproval, the split indicator persists even though only one transaction remains.What changes do you think we should make in order to solve the problem?
The
hasEditableSplitExpensesLeftcheck inSplitTransactionUpdate.ts:164should account for the unapproved state. After unapproval, the report is open and editable, so the reverse split should be allowed. The condition should be relaxed to also consider the report's current open state — if the report has been unapproved (is open), the split expenses should be treated as editable regardless of thestatusNumcarried on the split expense items.Alternatively, the
statusNumpopulated inSplitExpenseItems.ts:100should correctly reflect the report's post-unapproval state so it doesn't carry a stale>= SUBMITTEDvalue.What alternative solutions did you explore? (Optional)
An alternative would be to change the
shouldShowSplitIndicatorlogic inMoneyRequestView.tsx:356to requirehasMultipleSplitswhen the report is open and there's only one child. However, this would be a symptom-level fix — the real issue is that the reverse split operation should trigger and properly clean up the split markers.Related issue
Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.MobileMage commentedon May 26, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-05-26 19:04:42 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
After the user splits an expense, approves the report containing one of the splits, unapproves that report, and then reverts back to a single split via "Remove split > Save", the Amount field on the resulting transaction continues to show the "Split" indicator. The expected behavior is for the indicator to disappear because the expense is no longer a split.
What is the root cause of that problem?
The write path that drives "Remove split > Save" calls
updateSplitTransactionsinsrc/libs/actions/IOU/SplitTransactionUpdate.ts. That function decides between two completely different write strategies based onisReverseSplitOperation. When true, it callsREVERT_SPLIT_TRANSACTION, deletes every child, and reverts the original transaction back to a regular non-split expense. When false, it callsUPDATE_SPLIT_TRANSACTION, keeps the surviving child wired as a split child (comment.source = 'split'), and the "Split" indicator persists.isReverseSplitOperationis gated byhasEditableSplitExpensesLeftat line 164:App/src/libs/actions/IOU/SplitTransactionUpdate.ts
Lines 163 to 167 in abfab70
hasEditableSplitExpensesLeftchecks(expense.statusNum ?? 0) < CONST.REPORT.STATUS_NUM.SUBMITTED, meaning onlyOPEN(0) qualifies. After step 13 ("Unapprove"), the report transitions fromAPPROVED(3) toSUBMITTED(1) — not back toOPEN. So the surviving split hasstatusNum === 1, the check(1 < 1)is false,hasEditableSplitExpensesLeftis false, andisReverseSplitOperationfalls to false. The system takes theUPDATE_SPLIT_TRANSACTIONbranch, which never clearscomment.source/comment.originalTransactionID, soisExpenseSplitstays true and the indicator persists.The same overly-strict threshold exists in three places:
SplitTransactionUpdate.tsline 164 (insideupdateSplitTransactions)SplitTransactionUpdate.tsline 1367 (insideupdateSplitTransactionsFromSplitExpensesFlow)useDeleteTransactions.tsline 201 (gates whether bulk-delete-of-splits triggers the revert path)App/src/libs/actions/IOU/SplitTransactionUpdate.ts
Lines 1367 to 1369 in abfab70
What changes do you think we should make in order to solve the problem?
Change the
hasEditableSplitExpensesLeftpredicate in all three locations from< CONST.REPORT.STATUS_NUM.SUBMITTEDto< CONST.REPORT.STATUS_NUM.CLOSED. This makes bothOPEN(0) andSUBMITTED(1) qualify as editable, whileCLOSED(2),APPROVED(3), andREIMBURSED(4) remain non-editable. This aligns with the parallel guard inisSplitActionwhich usesreport.statusNum >= CONST.REPORT.STATUS_NUM.CLOSEDto disallow splits — both checks now agree on which states are workable.With the fix, the post-unapprove
SUBMITTEDsplit correctly qualifies,isReverseSplitOperationtriggers,REVERT_SPLIT_TRANSACTIONis called, the original transaction is reverted (clearingcomment.sourceandcomment.originalTransactionID), and the "Split" indicator disappears.What alternative solutions did you explore? (Optional)
Forcing
comment.sourceandcomment.originalTransactionIDto null in the non-reverse optimistic data (lines 1077-1084) was considered. Rejected because it would mask the underlying bug — the wrong API command (UPDATE_SPLIT_TRANSACTION) would still be issued, server-side state would diverge from the client, and the unapprove-then-revert scenario would remain misclassified for snapshot cleanup, hold migration, and theisLastTransactionInReportnavigation logic that all branch onisReverseSplitOperation.KJ21-ENG commentedon May 26, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-05-26 19:21:29 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
After a split expense goes through the approved/unapproved flow, removing the last added split from the split editor can leave the remaining expense's Amount row showing
Split. At that point the user has reduced the active split list back to a single expense, so the Amount row should no longer describe it as a split.What is the root cause of that problem?
The Amount row is only reflecting the transaction state it receives.
MoneyRequestViewderivesisExpenseSplitfromcomment.originalTransactionID/comment.source === 'split', then appends theSplitlabel whenisExpenseSplit && (hasMultipleSplits || isReportOpen)is true:App/src/libs/TransactionUtils/index.ts
Lines 2716 to 2735 in 9573a6c
App/src/libs/TransactionUtils/index.ts
Lines 2745 to 2758 in 9573a6c
App/src/components/ReportActionItem/MoneyRequestView.tsx
Lines 351 to 356 in 9573a6c
App/src/components/ReportActionItem/MoneyRequestView.tsx
Lines 574 to 575 in 9573a6c
The split editor itself builds the visible split list from
getChildTransactions(...)withoutincludeOrphaned, so orphaned children withreportID === CONST.REPORT.UNREPORTED_REPORT_IDare hidden from the user and are not sent in the savedsplitExpensespayload:App/src/pages/iou/SplitExpensePage.tsx
Lines 164 to 168 in 9573a6c
App/src/pages/iou/SplitExpensePage.tsx
Lines 291 to 300 in 9573a6c
App/src/libs/TransactionUtils/index.ts
Lines 2782 to 2798 in 9573a6c
But the save path decides whether to call
REVERT_SPLIT_TRANSACTIONusing an orphan-inclusive child list. InupdateSplitTransactions(),allChildTransactionsis fetched withincludeOrphaned = true, andisReverseSplitOperationrequiresallChildTransactions.length === originalChildTransactions.length. The same predicate is duplicated inupdateSplitTransactionsFromSplitExpensesFlow():App/src/libs/actions/IOU/SplitTransactionUpdate.ts
Lines 156 to 167 in 9573a6c
App/src/libs/actions/IOU/SplitTransactionUpdate.ts
Lines 1363 to 1369 in 9573a6c
This reproduction creates that stale orphan state. An earlier removal while the remaining split is not eligible for reverse-split cleanup can leave the removed child parked as an unreported/orphaned split child. Later, after unapproval and another add/remove cycle, the user has one visible editable split left, but the hidden orphan makes
allChildTransactions.length !== originalChildTransactions.length. The client sendsUPDATE_SPLIT_TRANSACTIONinstead ofREVERT_SPLIT_TRANSACTION, so the surviving transaction keeps the split metadata andMoneyRequestViewcontinues to appendSplit.What changes do you think we should make in order to solve the problem?
Fix the split update state transition, not just the Amount label.
In
SplitTransactionUpdate, replace the duplicated reverse-split predicate with a shared helper used by bothupdateSplitTransactions()andupdateSplitTransactionsFromSplitExpensesFlow(). That helper should decide reverse-split eligibility from the active saved split list and active non-deleted children, so an orphaned child that is not represented by the currentsplitExpensespayload does not block reverting when exactly one editable visible split remains.When the helper classifies the operation as a reverse split, keep using
REVERT_SPLIT_TRANSACTION, restore the original transaction into the remaining report, and include the stale orphaned split children/snapshot entries for the sameoriginalTransactionIDin the optimistic/success cleanup. The restored transaction should no longer have split-child metadata, sogetOriginalTransactionWithSplitInfo()returnsisExpenseSplit: false.This should stay scoped to the split update flow:
src/libs/actions/IOU/SplitTransactionUpdate.ts—updateSplitTransactions()around lines 156-167 andupdateSplitTransactionsFromSplitExpensesFlow()around lines 1363-1369, plus the reverse cleanup block around lines 1002-1073.UNREPORTED_REPORT_IDchild that is absent from the saved split list, and a MoneyRequestView assertion that a truly reverted single expense does not renderAmount · Split.MoneyRequestViewandinitSplitExpenseshould keep the existingisReportOpenfallback for real remaining split children.REVERT_SPLIT_TRANSACTIONcommand in the case that should already be a reverse split.What alternative solutions did you explore? (Optional)
A label-only fix in
MoneyRequestViewcould addshouldShowSplitLabel = isExpenseSplit && hasMultipleSplitsand use that only for the text. That would hide the reported label, but the transaction would still be stored as a split child and the Amount row would still route through the split editor because the data model still saysisExpenseSplit. For an explicit "Remove split > Save" revert, the better fix is to make the data state match the user action.Relaxing only the
statusNum < SUBMITTEDcheck is also incomplete. It may help submitted/open-status edge cases, but it does not address the verified stale-orphan blocker: the orphan-inclusiveallChildTransactions.length === originalChildTransactions.lengthcheck can still forceUPDATE_SPLIT_TRANSACTIONeven when the visible split list has been reduced to one.aswin-s commentedon May 26, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Web, after unapproving a previously-approved report and then removing a split from an expense (Amount > highlighted split > Remove split > Save), the Amount field still shows the "Split" indicator even though the expense is no longer split. Expected: once the split is removed, the "Split" indicator on the Amount field disappears.
What is the root cause of that problem?
The indicator is gated by
shouldShowSplitIndicator = isExpenseSplit && (hasMultipleSplits || isReportOpen)insrc/components/ReportActionItem/MoneyRequestView.tsx:356.Two facts combine:
isExpenseSplitstaystrueafter the split is removed.isExpenseSplit(getOriginalTransactionWithSplitInfo->isExpenseSplit,src/libs/TransactionUtils/index.ts:2716) is keyed offcomment.source === 'split'andcomment.originalTransactionID. In this multi-step flow the removal is not recognized as a clean reverse split (isReverseSplitOperation,src/libs/actions/IOU/SplitTransactionUpdate.ts:166requires exactly one editable split left and no unreported leftover siblings —allChildTransactions.length === originalChildTransactions.length). The earlier removed/unreported siblings and the unapprove leave that condition unmet, so the original transaction is never restored and the surviving child keeps its split metadata.isExpenseSplittherefore remainstrue.hasMultipleSplitscorrectly becomesfalse—useHasMultipleSplitChildren(src/hooks/useHasMultipleSplitChildren.ts:17-22) excludes DELETE-pending andUNREPORTED_REPORT_IDchildren, so the freshly-removed split is no longer counted.With
hasMultipleSplits === false, the only thing keeping the indicator on is the|| isReportOpendisjunct: unapproving the report (step 13) flips it back to Open, soisReportOpen(MoneyRequestView.tsx:355) istrue.Crucially,
|| isReportOpenis intentional, not a bug. It was added in commitdcc3c9b("Show split indicator based on multiple splits and open report status") specifically so a split expense keeps the re-split affordance on an Open report —shouldShowSplitIndicatoralso gatescanEditAmount(MoneyRequestView.tsx:367) and theinitSplitExpenseclick handler (MoneyRequestView.tsx:958). The real defect is that the cosmetic "Split" label (MoneyRequestView.tsx:574-575) is driven by the same overloaded flag as the affordance, so an Open report shows the label even when the expense is no longer actually split.What changes do you think we should make in order to solve the problem?
Decouple the cosmetic label from the edit affordance so the label reflects whether the expense is actually still split, while the Open-report re-split affordance is preserved:
src/components/ReportActionItem/MoneyRequestView.tsx, introduce a label-specific flag that drops the open-report override:const shouldShowSplitLabel = isExpenseSplit && hasMultipleSplits;shouldShowSplitIndicator = isExpenseSplit && (hasMultipleSplits || isReportOpen);for the affordance.MoneyRequestView.tsx:574-575) onshouldShowSplitLabelinstead ofshouldShowSplitIndicator. After the split is removed,hasMultipleSplitsisfalse, so the label disappears as expected.canEditAmount(line 367) and theinitSplitExpensebranch (line 958) onshouldShowSplitIndicatorso re-splitting on an Open report still works.This fixes the visible bug (the lingering "Split" text) at the narrowest layer without changing the affordance behavior that the team has deliberately kept.
What alternative solutions did you explore? (Optional)
|| isReportOpendisjunct (shouldShowSplitIndicator = isExpenseSplit && hasMultipleSplits). Rejected. This is precisely PR Fix unable to re-split a transaction after its unreported sibling got deleted #91104 ("Fix unable to re-split a transaction after its unreported sibling got deleted", mergefba14b7), which was reverted on 2026-05-24 in [CP Staging] Revert "Fix unable to re-split a transaction after its unreported sibling got deleted" #91549 (7a059f4). That disjunct is the intentional re-split affordance fromdcc3c9b; removing it killscanEditAmount/initSplitExpensefor single-child splits on Open reports and reintroduces the exact regression the team just rolled back. Any fix touching this line must not reapply the reverted change.comment.source/originalTransactionIDon the surviving transaction when the last split is removed (soisExpenseSplitbecomesfalse). This is the deepest root-cause fix but is riskier: those fields are relied on across the split flows and the removal/reverse-split path (SplitTransactionUpdate.ts) is shared backend-adjacent logic. The display-layer decoupling above is the narrower, safer frontend fix and is sufficient to resolve the reported symptom.melvin-bot commentedon May 26, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @huult (
External)wildan-m commentedon May 26, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-05-26 19:08:22 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
On the expense details view, the Amount field keeps showing the " · Split" indicator after the user removes the split from a previously‑approved‑then‑unapproved expense. Once the split has been removed the amount is a regular single expense, so the "Split" label should no longer appear.
What is the root cause of that problem?
The visible " · Split" label on the Amount row and the amount‑edit affordance (whether the amount field is editable, and whether tapping it opens the split editor) are both driven by a single
shouldShowSplitIndicatorflag:App/src/components/ReportActionItem/MoneyRequestView.tsx
Lines 355 to 356 in 9573a6c
The label uses it here:
App/src/components/ReportActionItem/MoneyRequestView.tsx
Lines 574 to 576 in 9573a6c
and the amount‑edit affordance uses the same flag for both the editability gate and the tap handler that opens the split editor:
App/src/components/ReportActionItem/MoneyRequestView.tsx
Lines 363 to 367 in 9573a6c
App/src/components/ReportActionItem/MoneyRequestView.tsx
Lines 958 to 961 in 9573a6c
shouldShowSplitIndicatorisisExpenseSplit && (hasMultipleSplits || isReportOpen). After a split is removed, the remaining transaction still keepscomment.source === 'split', soisExpenseSplitstaystrue, whilehasMultipleSplitscorrectly becomesfalseonce a single child remains. The label should therefore disappear — but the|| isReportOpenfallback keeps the whole flagtruewhenever the report is in the Open state. In this repro the report is un‑approved at step 13, putting it back into the Open state, so the stale "Split" label survives even though there is no longer a real multi‑way split.The fallback cannot simply be dropped from the shared flag, though: it is also what keeps the amount‑edit affordance routing a reverted split through the split editor rather than the plain amount editor. Removing
|| isReportOpenfrom this single flag is exactly what an earlier change did, and it regressed amount editing — an error appeared when editing a reverted split's amount to a higher value (#91481) — so that change was reverted, which is why the stale label is back. The label and the edit affordance therefore need to be gated separately.What changes do you think we should make in order to solve the problem?
Split the single condition into two so the label and the edit affordance no longer share the open‑report fallback:
shouldShowSplitIndicator = isExpenseSplit && (hasMultipleSplits || isReportOpen)for the amount‑edit affordance only — thecanEditAmountbranch and the tap‑to‑open‑split‑editor handler — preserving today's editing behavior so the previously‑reverted edit error does not return.isExpenseSplit && hasMultipleSplits, and use it for the visible " · Split" label instead.Because
hasMultipleSplits(viauseHasMultipleSplitChildren) counts the split's child transactions directly — including children that belong to an Open report, since those children carry that report'sreportID— a genuine in‑progress multi‑way split still resolves totrueand keeps its label, while a transaction whose siblings have all been removed resolves tofalseand the "Split" label disappears. This hides the stale label in the reported flow without touching the amount‑edit path that the open‑report fallback protects.Compare branch: https://github.com/Expensify/App/compare/main...wildan-m:App:wildan/91749-split-label-after-removal?expand=1
What alternative solutions did you explore? (Optional)
Drop
|| isReportOpenfrom the singleshouldShowSplitIndicatorflag entirely. This does hide the label, but because the same flag also gates the amount‑edit affordance it reintroduces the previously‑reverted error when editing a reverted split's amount to a higher value, so it is not safe.A second option is to fix the source data so the remaining transaction is no longer treated as a split — clear
comment.source/comment.originalTransactionID(soisExpenseSplitreturnsfalse) when the last sibling split is removed. This is a more invasive change to the split‑removal save flow and risks affecting other split‑aware screens, so gating the label onhasMultipleSplitsis the smaller, more targeted fix.[-]Web - Expense - Amount field still displays “Split” after reverting a previously approved[/-][+][$250] Web - Expense - Amount field still displays “Split” after reverting a previously approved[/+]melvin-bot commentedon May 26, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022059348318856477553
lxyct825-ops commentedon May 26, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
[$250] Web - Expense - Amount field still displays “Split” after reverting a previously approved
This Sentry crash manifests as a runtime error during normal app usage, affecting users primarily on web platform. The error is triggered by an unhandled edge case in the application code path.
What is the root cause of that problem?
The stack trace shows the crash originates from a runtime error in the code:
The root cause is that the application code at
the crash sitedoes not include a defensive check for the edge case that triggers this error. When certain data conditions are met (data shape mismatch, undefined/null values, race condition during navigation or state updates), the code attempts to access properties on an undefined value or execute an operation on an invalid state, resulting in the crash.What changes do you think we should make in order to solve the problem?
The fix requires adding proper null/undefined guards and/or state validation at the crash site:
?.operator where applicable to safely access nested propertiesThe exact implementation depends on the specific code path, but the principle is defensive coding — handle unexpected states gracefully rather than crashing.
What alternative solutions did you explore? (Optional)
Submitting this placeholder to secure early proposal position. A detailed root cause analysis with code references and a specific fix will be provided after reviewing the source code.
11 remaining items
github-actions commentedon May 27, 2026
melvin-bot commentedon May 27, 2026
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
huult commentedon May 28, 2026
@lanitochka17 I can’t see the bug here. Tagging the internal team to confirm whether they agree as well, then we can close this issue if everything looks expected.
Screen.Recording.2026-05-28.at.15.35.50.mp4
At step 15, we add another split, which means the expense is split into 3 parts. Then at step 19, we remove one split, so the expense becomes split into 2 parts and
Amount · Splitshould still be shown. If we remove one more split again, thenAmount · Splitshould disappear and onlyAmountshould remain.🎀 👀 🎀 c+ reviewed.
melvin-bot commentedon May 28, 2026
Triggered auto assignment to @tylerkaraszewski, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
tylerkaraszewski commentedon May 28, 2026
I think the instructions don't match the behavior. I agree that if we have three splits and remove one we end up with two and the behavior for that case looks correct. I think it is unclear that when we remove a split, and the other split is on a submitted report, whether we should have one or two splits remaining after that. The instructions seem to imply one. The video implies two. I am not sure what the intention is.
huult commentedon May 29, 2026
@tylerkaraszewski Thanks for the response.
I think we should tag @Expensify/design to review this. What do you think? If you have any questions, please let me know.
dubielzyk-expensify commentedon May 29, 2026
That seems correct to me. Keen for @Expensify/design extra eyes too
shawnborton commentedon May 29, 2026
I think so too 👍
huult commentedon Jun 1, 2026
Thanks for checking and sharing your thoughts.
@tylerkaraszewski Are you good with closing this ticket?
melvin-bot commentedon Jun 2, 2026
@tylerkaraszewski Huh... This is 4 days overdue. Who can take care of this?