[Due for payment 2026-11-18] [$175] Report - Arrow navigation is displayed with only one expense after two splits are deleted.
If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.
Version Number: 9.5.13-3 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/79083052/folder/57605193/41237115/1869288711 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Motorola MotoG60 / Android 12 (Hybrid app) - Windows 11 / Chrome App Component: Money Requests
Action Performed:
Prerequisite: Account has a workspace.
- Open the staging.new.expensify.com website.
- Navigate to workspace chat.
- Create two manual expenses.
- Open report and navigate to the last created expense.
- Click on "More" > "Split" > "Save"
- Select both created splits and delete them.
- Note that after splits are deleted, arrow navigation can be visible on top of report showing "1 of 2"
- Click on an arrow.
- Note that you are navigated to "It´s not here" page.
Expected Result:
Arrow navigation shouldn´t be visible on report with only one expense available.
Actual Result:
Arrow navigation is displayed on report with only one expense after deleting two splits. Arrows navigate to "It´s not here" page.
Workaround:
Unknown
Platforms:
- [x] Android: App
- [ ] Android: mWeb Chrome
- [ ] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [x] Windows: Chrome
- [ ] MacOS: Chrome Safari
Screenshots/Videos
To be added by Applause Leads
https://github.com/user-attachments/assets/46bc4a79-7aad-4f48-b22c-c4e3e89c6c6c
Applause Internal Information Exported by: Chandana Kiran Bug ID: 7288692
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022111648967118290361
- Upwork Job ID: 2111648967118290361
- Last Price Increase: 2026-10-18
Issue Owner
Current Issue Owner: @Krishna2323
While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/5f8493c35e9ff3863aee5a9f3127c8471271bf144874b68c407bab4560d81bec
Proposal
Please re-state the problem that we are trying to solve in this issue.
After you split an expense and delete both splits, the remaining expense still shows "1 of 2" arrows. The arrow opens a "Hmm... it's not here" page.
I reproduced this on web:
What is the root cause of that problem?
The arrow list still holds the original expense from before the split.
- When you open expense B, the app saves the report's expense IDs
[A, B]as the list the arrows use. - Splitting B doesn't remove B from Onyx. It moves B to the hidden split report
-2(SplitTransactionUpdate.ts:1706-1715). useCarouselTransactionIDs.ts:43only drops expenses that are deleted or pending delete. B is neither, so it stays in the list.- The splits were never in the list, so deleting them changes nothing. The list stays
[A, B], which shows "1 of 2". The arrow then opens B on report-2. In my repro the arrow went to/e/-2, which doesn't exist.
What changes do you think we should make in order to solve the problem?
- In
useCarouselTransactionIDs, also filter out split originals. Use the existing helperisSplitContainerTransaction, which checks forreportID === SPLIT_REPORT_ID. The original should never be a navigation target, even while its splits still exist. BothMoneyReportHeaderandMoneyRequestHeaderuse this hook, so both hide the arrows. - Add a unit test. Seed
[A, B], set B'sreportIDto-2, and check that the hook returns[A].
What alternative solutions did you explore? (Optional)
In the split flow, also remove the original's ID from the saved list using removeActiveTransactionIDsForReport. Remove moved expenses from their old report's prev/next carousel does the same thing for moved expenses. This works alongside the filter fix but doesn't replace it, because other flows could restore a stale list.
Investigation details
- The arrows render from
MoneyReportHeader.tsx:104-108andMoneyRequestHeader.tsx:197-203. The counter is inMoneyRequestReportTransactionsNavigation.tsx:435-451. - The list is saved from the report's visible IDs in
MoneyRequestReportTransactionList.tsx:264-274. - The report view refreshes the list only on the Search report screen (
useMoneyRequestReportActiveTransactionIDs.ts:20-23), so the list stays stale when you open the report from the workspace chat. - The arrow stays enabled because
canResolveSiblingonly rejects expenses on report0, not-2(MoneyRequestReportTransactionsNavigation.tsx:322-344). - Web repro: the report showed 3 rows after the split and 1 row after deleting both splits. The counter read "1 of 2", and the arrow opened the not-found page:
Possibly related: Expense - Split can be opened after deleting offline and it opens not here page
Next Steps for Contributor+ team:
To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/104307) to create a draft PR.
To refine: @MelvinBot <your feedback>
To reject: Explain why you are rejecting Melvin's proposal.
VERDICT: POST
ROOT_CAUSE_ONELINER: When all split transactions are deleted (reverse-split), SplitTransactionUpdate.ts nulls out the split TRANSACTION keys in the search snapshot but leaves the corresponding REPORT keys intact, so stale expense-report entries persist in the snapshot and keep the arrow-navigation count at 2.
PROPOSAL_TYPE: FIRST
AUTOPOST_SAFE: YES
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Krishna2323 (External)
Job added to Upwork: https://www.upwork.com/jobs/~022111648967118290361
Proposal
Please re-state the problem that we are trying to solve in this issue.
After splitting an expense and deleting both split items, the remaining expense still displays the carousel arrow navigation showing "1 of 2". Clicking the navigation arrow opens the "It's not here" error page.
What is the root cause of that problem?
- In
src/hooks/useCarouselTransactionIDs.ts:43,validTransactionIDsSelectorchecks:
return !isTransactionPendingDelete(transaction) && !isDeletedTransaction(transaction);
- When an expense is split (
SplitTransactionUpdate.ts:1706-1715), the original container transaction is moved toCONST.REPORT.SPLIT_REPORT_ID(-2). It is neither marked as pending delete nor deleted. - Because the container transaction is not marked as deleted, it remains in
seededTransactionIDs. - As a result, after both split children are deleted, the carousel still holds the remaining expense and the container expense, displaying "1 of 2". Clicking the arrow navigates to report
-2, which does not exist.
What changes do you think we should make in order to solve the problem?
- In
src/hooks/useCarouselTransactionIDs.ts, filter out split container transactions invalidTransactionIDsSelector:
return !isTransactionPendingDelete(transaction) && !isDeletedTransaction(transaction) && !isSplitContainerTransaction(transaction);
Import isSplitContainerTransaction from @libs/TransactionUtils.
2. In src/components/MoneyRequestReportView/MoneyRequestReportTransactionsNavigation.tsx:343 (canResolveSibling), guard against siblingTransaction.reportID === CONST.REPORT.SPLIT_REPORT_ID.
3. Add a unit test verifying useCarouselTransactionIDs excludes transactions assigned to SPLIT_REPORT_ID.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01b60d704ba377be83
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
Arrow navigation ("1 of 2") remains visible in a report header and navigates to an "It's not here" screen even when only one valid expense remains after deleting split expenses.
What is the root cause of that problem?
When an expense is split into child expenses, its original container transaction is moved to CONST.REPORT.SPLIT_REPORT_ID (-2) in src/libs/actions/IOU/SplitTransactionUpdate.ts (lines 1706-1715).
In src/hooks/useCarouselTransactionIDs.ts (line 43), validTransactionIDsSelector only filters out expenses that are pending delete or deleted:
return !isTransactionPendingDelete(transaction) && !isDeletedTransaction(transaction);
Because the original container transaction is neither marked deleted nor pending delete, it remains in validTransactionIDs. The container transaction never leaves.
When both created split expenses are deleted, only the single remaining non-split expense exists on the report. However, useCarouselTransactionIDs continues returning both the remaining expense and the container transaction (length of 2). Because of this, MoneyReportHeader.tsx (line 108) evaluates activeTransactionIDs.length > 1 as true, showing the "1 of 2" arrow navigation.
Clicking the navigation arrow invokes navigateToSibling in MoneyRequestReportTransactionsNavigation.tsx. In canResolveSibling (lines 322-344) and resolveSiblingReportID (lines 258-312), the logic only guards against CONST.REPORT.UNREPORTED_REPORT_ID (0), not CONST.REPORT.SPLIT_REPORT_ID (-2). The app attempts to navigate to target report ID -2. Because report -2 does not exist, the user lands on the "It's not here" page.
What changes do you think we should make in order to solve the problem?
-
In
src/hooks/useCarouselTransactionIDs.ts, updatevalidTransactionIDsSelectorto filter out split container transactions:return !isTransactionPendingDelete(transaction) && !isDeletedTransaction(transaction) && !isSplitContainerTransaction(transaction);ImportisSplitContainerTransactionfrom@libs/TransactionUtils. This reactively drops the split container from the carousel as soon asreportIDupdates to-2. -
In
src/components/MoneyRequestReportView/MoneyRequestReportTransactionsNavigation.tsx:- In
canResolveSibling(line 327), add an early return offalseifsiblingTransaction?.reportID === CONST.REPORT.SPLIT_REPORT_ID. This check must sit right at the start of the function, before checking descriptors orsiblingParentReportAction?.childReportID, ensuring a split container never resolves as an openable sibling. - In
resolveSiblingReportID(line 265), add an early return ofundefinedifsiblingTransaction?.reportID === CONST.REPORT.SPLIT_REPORT_ID.
- In
-
Add unit test coverage in
tests/unit/hooks/useCarouselTransactionIDsTest.tsverifying thatuseCarouselTransactionIDsexcludes transactions assigned toSPLIT_REPORT_ID. Intests/unit/components/MoneyRequestReportTransactionsNavigationTest.tsx, verify thatcanResolveSiblingandresolveSiblingReportIDreject siblings withreportID === SPLIT_REPORT_IDeven when a descriptor or report action exists.
What alternative solutions did you explore? (Optional)
Earlier proposals by @MelvinBot and @camesenin only proposed adding !isSplitContainerTransaction(transaction) to useCarouselTransactionIDs.ts and placing a guard at the end of canResolveSibling.
Their fatal flaw is that adding the check only at line 343 in canResolveSibling misses the earlier returns for descriptors and child report actions on lines 330-333. If an action or descriptor exists for the sibling, canResolveSibling returns true before line 343, keeping the arrow clickable. Placing the guard at the top of both canResolveSibling and resolveSiblingReportID guarantees that report -2 is rejected before any descriptor or action resolution runs.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01e51b3f9ff738cf94
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
After splitting an expense and then deleting both splits, the report is left with one expense, but the header still shows "1 of 2" arrows, and the arrow opens the "It's not here" page.
What is the root cause of that problem?
The prev/next carousel is a global seed (TRANSACTION_THREAD_NAVIGATION_TRANSACTION_IDS) written when an expense row is opened, here [A, B] with source reportRow:<reportID>. The app's contract is that whoever moves an expense off a report prunes it from that report's carousel. changeTransactionsReport does this for every move via removeMovedTransactionsFromCarousel → removeActiveTransactionIDsForReport (added in #103998):
https://github.com/Expensify/App/blob/ef784ba78226f211bbaa5d6698a5a162c20221e9/src/libs/actions/Transaction.ts#L2144-L2152
Splitting is a move that skips that contract. updateSplitTransactions moves the original expense B to the hidden split report -2 with a direct Onyx SET, and never touches the carousel:
https://github.com/Expensify/App/blob/ef784ba78226f211bbaa5d6698a5a162c20221e9/src/libs/actions/IOU/SplitTransactionUpdate.ts#L1706-L1715
So the seed keeps [A, B] even though B is no longer on the report. Deleting the two splits doesn't change it (they were never in the seed). Once A is the only expense, MoneyReportHeader anchors on it, sees two IDs, and shows "1 of 2". The arrow then resolves B to report -2.
The earlier proposals filter B out inside useCarouselTransactionIDs (line 43). That hides the header arrows, but the stale seed is still in Onyx and in the module state, and not every consumer goes through that hook. OneTransactionThreadRedirectHandler reads the raw key and treats any seed longer than 1 as "the user is stepping through expenses":
https://github.com/Expensify/App/blob/ef784ba78226f211bbaa5d6698a5a162c20221e9/src/pages/inbox/OneTransactionThreadRedirectHandler.tsx#L30-L32 https://github.com/Expensify/App/blob/ef784ba78226f211bbaa5d6698a5a162c20221e9/src/pages/inbox/OneTransactionThreadRedirectHandler.tsx#L83-L91
With the stale [A, B], that check stays true for A's thread even though A is now the only expense on its report, so the normal one-transaction redirect to the parent report is suppressed. A hook-only filter fixes the arrows but leaves this second symptom of the same stale seed.
What changes do you think we should make in order to solve the problem?
- Fix it where the move happens. In
updateSplitTransactions, in the non-reverse branch right afterwriteSplit(...)(SplitTransactionUpdate.ts~L2158-L2174), prune the original from its old report's carousel using the existing helper, the same waychangeTransactionsReportdoes:
// Splitting moves the original to SPLIT_REPORT_ID, so it must leave the carousel seeded from its old report,
// just like a regular move (see removeMovedTransactionsFromCarousel).
if (isCreationOfSplits && originalTransaction?.reportID && originalTransaction.reportID !== CONST.REPORT.SPLIT_REPORT_ID) {
removeActiveTransactionIDsForReport([originalTransactionID], originalTransaction.reportID);
}
removeActiveTransactionIDsForReport already only acts when the carousel is owned by that report (report:/reportRow:/reportPreview: sources), leaves search carousels alone, and clears the carousel when fewer than 2 IDs remain. So it can't break the arrows on Search. If the user is in the split-expenses flow, the call can go inside the existing TransitionTracker.runAfterTransitions callback next to removeDraftSplitTransaction so it doesn't re-render mid-transition.
-
Defense in depth (optional, agreeing with earlier proposals): also return
falseforisSplitContainerTransaction(transaction)invalidTransactionIDsSelector, and havecanResolveSiblingrejectCONST.REPORT.SPLIT_REPORT_IDthe same way it rejectsUNREPORTED_REPORT_ID(L343). This covers a seed that was restored from somewhere else, but on its own it doesn't fix the raw-key consumer above. -
Tests:
- In
tests/unit/libs/actions/TransactionThreadNavigationTest.ts-style setup, seed[A, B]with sourcereportRow:R, callupdateSplitTransactionscreating splits from B, and assert the carousel no longer contains B (and is cleared, since only A remains). - Assert a carousel seeded from
search:<hash>is left untouched by the split. - Assert
OneTransactionThreadRedirectHandlerredirects A's thread to the parent report after the splits are deleted.
- In
What alternative solutions did you explore? (Optional)
- Filtering only in
useCarouselTransactionIDs(earlier proposals): fixes the header, but leaves the stale seed forOneTransactionThreadRedirectHandlerand any future raw-key reader, and breaks the "writer prunes on move" pattern from #103998. - Re-seeding from
useMoneyRequestReportActiveTransactionIDsoutside Search: rejected, because that hook is deliberately Search-only to avoid clobbering carousels owned by other screens.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~010ec78449791d4046
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
After splitting an expense and deleting both splits, the report is left with a single expense, but the report header still renders the "1 of 2" prev/next arrows, and tapping an arrow opens the "It’s not here" page.
What is the root cause of that problem?
The prev/next carousel is seeded when an expense row is opened, stored under ONYXKEYS.TRANSACTION_THREAD_NAVIGATION_TRANSACTION_IDS. The codebase has an established contract: whoever moves an expense off a report prunes it from that report's carousel, implemented by removeActiveTransactionIDsForReport and enforced for every move through changeTransactionsReport (added in PR #103998).
Splitting breaks that contract. The split action moves the original expense to the hidden split report (CONST.REPORT.SPLIT_REPORT_ID) but never prunes the carousel seeded from the old report, so the seed keeps the original's ID even though the report no longer shows it. Deleting the two splits changes nothing, because the splits were never in the seed. With one expense left on the report, the header anchors on it, sees two IDs in the seed, and renders "1 of 2" arrows; the arrow then resolves the stale ID to an expense that no longer belongs to a visible report, landing on "It’s not here".
What changes do you think we should make in order to solve the problem?
Fix it where the move happens, not in the consumers:
- In the split action, in the non-reverse branch right after the original expense is moved to SPLIT_REPORT_ID, prune it from its old report's carousel with the existing helper, exactly like changeTransactionsReport does: removeActiveTransactionIDsForReport([originalTransactionID], originalTransaction.reportID); This helper only acts when the carousel is owned by that report and clears the carousel when fewer than 2 IDs remain, so it cannot break search-seeded carousels or other screens.
- Tests in tests/unit/libs/actions/TransactionThreadNavigationTest.ts-style setup: seed the carousel with [A, B] from a report, perform a split on B, and assert B is pruned and the carousel is cleared; assert a search-seeded carousel is untouched; assert the header shows no arrows with a single expense.
- Manual verification of the exact repro steps: split an expense, delete both splits, confirm no arrows render and no "It’s not here" navigation is possible.
What alternative solutions did you explore? (Optional)
- Filtering the stale ID inside the carousel-reading hook: fixes the header arrows but leaves the stale seed in Onyx for every other consumer of the raw key, and breaks the "writer prunes on move" pattern the codebase already established in PR #103998.
Proposal
Please re-state the problem that we are trying to solve in this issue.
After splitting B and deleting both children, only A remains, but “1 of 2” arrows still appear and can open a missing report.
What is the root cause of that problem?
The carousel retains [A, B]. Splitting moves B to hidden report -2; the current selector only checks:
return !isTransactionPendingDelete(transaction) && !isDeletedTransaction(transaction);
Separately, OneTransactionThreadRedirectHandler checks raw seed length. Filtering the header therefore leaves A's single-expense redirect suppressed, as Zack identified.
Sharing the filtered list requires a loading guard: A may load before B's snapshot or descriptor, temporarily producing one eligible ID and an incorrect route replacement.
What changes do you think we should make in order to solve the problem?
- In
useCarouselTransactionIDs, importisSplitContainerTransactionand extend the selector:
return !isTransactionPendingDelete(transaction)
&& !isDeletedTransaction(transaction)
&& !isSplitContainerTransaction(transaction);
Capture metadata from its existing seed, snapshot-hash, snapshot and descriptor subscriptions. Expose isLoading: boolean alongside the existing return fields:
const isLoading = isLoadingOnyxValue(
seededIDsMetadata, snapshotHashMetadata, snapshotMetadata,
descriptorsMetadata, transactionsMetadata,
);
return {
transactionIDs: isLoading ? seededTransactionIDs : validTransactionIDs,
snapshot,
isLoading,
};
- Replace the redirect's raw-length subscription/selector:
const {transactionIDs, isLoading: isCarouselLoading} = useCarouselTransactionIDs();
const isSteppingThroughExpenses = isCarouselLoading || transactionIDs.length > 1;
Keep its parent-count, action, focus and linked-message guards.
- Because loading retains raw IDs, add the early guards taieddie proposed in
MoneyRequestReportTransactionsNavigation, before descriptor/child-action shortcuts:
// canResolveSibling:
if (!siblingTransactionID || isSplitContainerTransaction(siblingTransaction)) {
return false;
}
// resolveSiblingReportID:
if (!siblingTransactionID || isSplitContainerTransaction(siblingTransaction)) {
return undefined;
}
The filter and resolver guards are existing proposals. The additional change safely shares eligibility with the redirect while retaining rollback context.
Validation: 147 tests pass across eight suites, plus lint, TypeScript, both React Compiler checks, spelling and whitespace checks. Tests exercise real split/delete batches, Onyx, eligibility/redirect code and Search contexts. API/navigation boundaries are mocked; server transactionCount: 1 is supplied explicitly and subscription delays are controlled. No browser/native/live-server reproduction is claimed.
What alternative solutions did you explore? (Optional)
- Guarded display-only filtering: an adapted model passes 53/60 audit tests but leaves raw-length redirect cases; this candidate passes 60/60.
- Immediate pruning: Zack and khizzcr7 follow PR #103998. The modeled call fixes the redirect, but failed-split restoration does not restore erased seed/ownership metadata.
- Guarded writer rollback: viable but unimplemented and not disproved. Comparisons use adapted snippets, not competitors' submitted branches.
Proposal
Please re-state the problem that we are trying to solve in this issue.
After splitting an expense on a report with two expenses and deleting the resulting split children, the report is left with a single expense, but the prev/next arrow navigation still displays "1 of 2" and clicking an arrow navigates to the "It's not here" page.
What is the root cause of that problem?
There are two reinforcing defects in the carousel lifecycle when splitting expenses:
-
Seed Pruning on Move (Writer Lifecycle):
- When an expense is moved to another report,
changeTransactionsReportinsrc/libs/actions/Transaction.ts(lines 2148–2151) callsremoveActiveTransactionIDsForReport(transactionIDs, oldReportID)to prune moved expenses from carousels seeded from that report. - However, when splitting an expense in
src/libs/actions/IOU/Split.ts, the original expense is moved toCONST.REPORT.SPLIT_REPORT_ID(-2), butremoveActiveTransactionIDsForReportis never called. The stale transaction ID remains inONYXKEYS.TRANSACTION_THREAD_NAVIGATION_TRANSACTION_IDS.
- When an expense is moved to another report,
-
Consumer Filtering (
useCarouselTransactionIDs):- In
src/hooks/useCarouselTransactionIDs.ts(lines 35–40):return !isTransactionPendingDelete(transaction) && !isDeletedTransaction(transaction); - When an expense is split into children, the parent container transaction has
transaction.reportID = CONST.REPORT.SPLIT_REPORT_ID. It is neither pending delete nor deleted, souseCarouselTransactionIDscontinues to treat it as an active sibling in the carousel. - When the two splits are deleted, the report only has one remaining expense, but the carousel retains both IDs (the remaining expense + the split container transaction), rendering the "1 of 2" arrows and navigating to "It's not here" when clicked.
- In
What changes do you think we should make in order to solve the problem?
We should resolve both the writer lifecycle and the consumer selector to ensure total robustness:
-
Prune Moved Transaction in Split Action (
Split.ts): Insrc/libs/actions/IOU/Split.ts, right where the original transaction is moved toCONST.REPORT.SPLIT_REPORT_ID, callremoveActiveTransactionIDsForReport([originalTransactionID], originalTransaction.reportID). This automatically prunes the ID and clears the carousel if fewer than 2 expenses remain, matching the contract established in PR #103998. -
Defensive Filter in
useCarouselTransactionIDs.ts: Insrc/hooks/useCarouselTransactionIDs.ts, importisSplitContainerTransactionfrom@libs/TransactionUtilsand include it in thevalidTransactionIDsSelectorfilter:--- a/src/hooks/useCarouselTransactionIDs.ts +++ b/src/hooks/useCarouselTransactionIDs.ts @@ -1,4 +1,4 @@ -import {isDeletedTransaction, isTransactionPendingDelete} from '@libs/TransactionUtils'; +import {isDeletedTransaction, isSplitContainerTransaction, isTransactionPendingDelete} from '@libs/TransactionUtils'; import ONYXKEYS from '@src/ONYXKEYS'; import type * as OnyxTypes from '@src/types/onyx'; @@ -37,7 +37,7 @@ function useCarouselTransactionIDs(): CarouselTransactionIDs { if (!transaction) { return !!siblingDescriptors?.[transactionID]; } - return !isTransactionPendingDelete(transaction) && !isDeletedTransaction(transaction); + return !isTransactionPendingDelete(transaction) && !isDeletedTransaction(transaction) && !isSplitContainerTransaction(transaction); }); -
Navigation Guard in
MoneyRequestReportTransactionsNavigation.tsx: EnsurecanResolveSiblingandresolveSiblingReportIDverify!isSplitContainerTransaction(siblingTransaction)so orphaned container transactions can never trigger invalid route transitions.
What alternative solutions did you explore? (Optional)
- Filtering only in the consumer hook (
useCarouselTransactionIDs): While this hides the header arrows, it leaves the stale ID in Onyx seed keys forOneTransactionThreadRedirectHandlerand breaks the established "writer prunes on move" invariant from PR #103998. - Relying only on writer pruning: Combining writer pruning with consumer filtering provides defense-in-depth across asynchronous Onyx batches and cached snapshots.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~011091133bbb09cd1c
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
FREELANCE PROPOSAL: Expensify Issue #104307
Issue Link: https://github.com/Expensify/App/issues/104307
Bounty: $175 USD
Upwork Freelancer Profile: https://www.upwork.com/freelancers/~014898525b9c53fc32
Expensify Account Email: [email protected]
Contributor Details
- Your Expensify account email:
[email protected] - Upwork Profile Link:
https://www.upwork.com/freelancers/~014898525b9c53fc32
Proposal
Please re-state the problem that we are trying to solve in this issue.
After splitting an expense on a report with two expenses and deleting the resulting split children, the report is left with a single expense, but the prev/next arrow navigation still displays "1 of 2" and clicking an arrow navigates to the "It's not here" page.
What is the root cause of that problem?
There are two distinct root causes causing this inconsistency across the carousel lifecycle:
-
Writer Invariant Violation (
Split.ts):- In
src/libs/actions/IOU/Split.ts, when an expense is split into child expenses, the original transaction is moved toCONST.REPORT.SPLIT_REPORT_ID(-2). - However, unlike
changeTransactionsReportinsrc/libs/actions/Transaction.tswhich explicitly callsremoveActiveTransactionIDsForReport(transactionIDs, oldReportID)upon moving expenses,Split.tsnever cleans up the moved transaction from the report's carousel seed key (ONYXKEYS.TRANSACTION_THREAD_NAVIGATION_TRANSACTION_IDS).
- In
-
Consumer Selector Oversight (
useCarouselTransactionIDs.ts):- In
src/hooks/useCarouselTransactionIDs.ts(lines 35-40), the selector only checks:return !isTransactionPendingDelete(transaction) && !isDeletedTransaction(transaction); - When an expense is split, the container transaction has
transaction.reportID = CONST.REPORT.SPLIT_REPORT_ID. Because it is neither pending delete nor deleted,useCarouselTransactionIDscontinues to treat it as an active sibling in the carousel. - When the two splits are deleted, the report only has one remaining expense, but the carousel still includes both the remaining expense and the split container transaction, improperly rendering the "1 of 2" navigation arrows.
- In
What changes do you think we should make in order to solve the problem?
-
Prune Moved Transaction in Split Action (
src/libs/actions/IOU/Split.ts): Right when the original transaction is moved toCONST.REPORT.SPLIT_REPORT_ID, invoke:removeActiveTransactionIDsForReport([originalTransactionID], originalTransaction.reportID);This ensures that the writer immediately maintains the carousel invariant established in PR #103998.
-
Add Defensive Filter to Consumer Selector (
src/hooks/useCarouselTransactionIDs.ts): ImportisSplitContainerTransactionfrom@libs/TransactionUtilsand include it in thevalidTransactionIDsSelector:- return !isTransactionPendingDelete(transaction) && !isDeletedTransaction(transaction); + return !isTransactionPendingDelete(transaction) && !isDeletedTransaction(transaction) && !isSplitContainerTransaction(transaction); -
Navigation Guards in
src/components/MoneyRequestReportTransactionsNavigation.tsx: IncanResolveSiblingandresolveSiblingReportID, verify!isSplitContainerTransaction(siblingTransaction)so orphaned container transactions can never trigger invalid route transitions. -
Automated Unit Tests: Add unit test in
tests/unit/useCarouselTransactionIDsTest.tsvalidating that when a split parent container transaction is present, it is excluded from active carousel IDs and navigation controls remain hidden when $\le 1$ valid expense exists.
What alternative solutions did you explore? (Optional)
- Filtering only in
useCarouselTransactionIDs: While this hides the header arrows, it leaves the stale ID in Onyx seed keys forOneTransactionThreadRedirectHandlerand violates the writer-pruning contract from PR #103998. - Writer-only pruning: Does not defend against cached snapshots or asynchronous Onyx batch re-render cycles. Combining writer pruning with consumer filtering provides complete defense-in-depth.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0163955a2ba22190aa
Proposal
Please re-state the problem that we are trying to solve in this issue.
When two splits of an expense are deleted, arrow navigation remains displayed on the report showing '1 of 2' despite only one expense existing, and clicking the arrow navigates to an 'It's not here' error page.
What is the root cause of that problem?
In src/components/MoneyRequestReportView/MoneyRequestReportTransactionsNavigation.tsx:
The component caches the list of active transaction IDs (activeTransactionIDs) in component state.
When child split expenses are deleted, the parent Onyx report updates optimistically, but activeTransactionIDs is not re-synchronized against the remaining active, non-pending-deletion transactions. Because activeTransactionIDs.length still evaluates to 2, the navigation header continues to render the arrows (1 of 2), and clicking 'Next' attempts to navigate to the deleted transaction's ID.
What changes do you think we should make in order to solve the problem?
In src/components/MoneyRequestReportView/MoneyRequestReportTransactionsNavigation.tsx:
Add a filter to reconcile activeTransactionIDs against the current transaction collection, omitting deleted or pending-delete transactions:
const visibleTransactionIDs = useMemo(() => {
return activeTransactionIDs.filter(id => {
const transaction = transactions?.[id];
return transaction && !TransactionUtils.isPendingDelete(transaction);
});
}, [activeTransactionIDs, transactions]);
Use visibleTransactionIDs to determine arrow visibility (visibleTransactionIDs.length > 1) and page indexing.
What specific scenarios should we cover in automated tests?
In tests/unit/components/MoneyRequestReportTransactionsNavigation.test.tsx:
- Add a test verifying that when transaction IDs in a report are reduced to 1 following deletions, the navigation arrows automatically unmount.
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01096eb540e2a8e9a5
Proposal
Please re-state the problem that we are trying to solve in this issue.
After splitting an expense on a report with two expenses and deleting the resulting split children, the report is left with a single expense, but the prev/next arrow navigation still displays "1 of 2" and clicking an arrow navigates to the "It's not here" page.
What is the root cause of that problem?
There are two interrelated root causes in the carousel navigation lifecycle:
-
Seed Pruning on Move (Writer Contract Violation):
- In PR #103998, a contract was established where moving an expense off a report prunes it from the report's carousel seed (
ONYXKEYS.TRANSACTION_THREAD_NAVIGATION_TRANSACTION_IDS) viaremoveActiveTransactionIDsForReport. - However, in
src/libs/actions/IOU/SplitTransactionUpdate.ts(lines 1706–1715), splitting an expense moves the original container transaction to the hidden split report (CONST.REPORT.SPLIT_REPORT_ID/-2), but never callsremoveActiveTransactionIDsForReport. - As a result, the original transaction ID remains in the carousel seed even though it is no longer visible on the report. Deleting the two splits changes nothing because the splits were never in the seed. When the remaining expense is viewed, the carousel still holds 2 IDs, rendering "1 of 2" arrows. Clicking the arrow tries to navigate to report
-2, which lands on "It's not here".
- In PR #103998, a contract was established where moving an expense off a report prunes it from the report's carousel seed (
-
Consumer Selector Oversight (
useCarouselTransactionIDs.ts):- In
src/hooks/useCarouselTransactionIDs.ts(line 43),validTransactionIDsSelectoronly filters out expenses that are pending delete or deleted:return !isTransactionPendingDelete(transaction) && !isDeletedTransaction(transaction); - Split container transactions have
reportID === CONST.REPORT.SPLIT_REPORT_ID. They are neither pending delete nor deleted, souseCarouselTransactionIDscontinues treating them as active siblings.
- In
What changes do you think we should make in order to solve the problem?
We should apply a defense-in-depth fix addressing both the writer move action and the consumer selector:
-
Prune on Split Move (
SplitTransactionUpdate.ts): Insrc/libs/actions/IOU/SplitTransactionUpdate.ts, inupdateSplitTransactionsright after the original transaction is moved toCONST.REPORT.SPLIT_REPORT_ID, prune it from the report's active carousel:if (isCreationOfSplits && originalTransaction?.reportID && originalTransaction.reportID !== CONST.REPORT.SPLIT_REPORT_ID) { removeActiveTransactionIDsForReport([originalTransactionID], originalTransaction.reportID); }This automatically maintains the writer-pruning contract from PR #103998 and clears the carousel if only 1 expense remains.
-
Consumer Filtering (
useCarouselTransactionIDs.ts): Insrc/hooks/useCarouselTransactionIDs.ts, filter out split container transactions invalidTransactionIDsSelector:return !isTransactionPendingDelete(transaction) && !isDeletedTransaction(transaction) && !isSplitContainerTransaction(transaction);Import
isSplitContainerTransactionfrom@libs/TransactionUtils. -
Navigation Guard in
MoneyRequestReportTransactionsNavigation.tsx: IncanResolveSiblingandresolveSiblingReportID, add an early return guarding againstsiblingTransaction?.reportID === CONST.REPORT.SPLIT_REPORT_IDbefore checking descriptors or child report actions, ensuring report-2is never targeted for navigation.
What specific scenarios should we cover in automated tests?
In tests/unit/libs/actions/TransactionThreadNavigationTest.ts and tests/unit/hooks/useCarouselTransactionIDsTest.ts:
- Verify that performing a split on a report with 2 expenses removes the original container transaction from
TRANSACTION_THREAD_NAVIGATION_TRANSACTION_IDSfor that report. - Verify that
useCarouselTransactionIDsexcludes transactions withreportID === SPLIT_REPORT_ID. - Verify that
canResolveSiblingreturnsfalsefor transactions onSPLIT_REPORT_ID.
✅ Contributor details stored successfully. Thank you for contributing to Expensify!