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] Reports- Tap back button on RHP navigate to thread instead of Spend - Expenses #107808
BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors
Version Number: 9.5.53-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:#104926 Email or phone of affected tester (no customers):duytestnguyen+dk106@gmail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Windows 11 Chrome App Component: Chat Report View
changed the title [-]Reports- Tap back button on RHP navigate to thread instead of Spend - Expenses[/-][+][$175] Reports- Tap back button on RHP navigate to thread instead of Spend - Expenses[/+]on Nov 24, 2026
Created a disposable $1.07 expense and comment. Verification stopped at an unsupported right-click operation, so the reported navigation bug remains unverified.
Step
Status
Open Spend > ExpensesInitially empty; the disposable expense appeared after creation.
✅
Open an expense with an existing commentReopened the expense and confirmed its saved comment.
✅
Right-click comment → Reply in threadDriver returned UNSUPPORTED_OPERATION for secondary-click; hovering exposed no reply action.
❌
Click the parent commentBlocked before entering the thread.
❌
Click expense header Back → Spend > ExpensesNot executed from the required thread-origin state.
❌
Preliminary analysis — low confidence
Suspected mechanism: Parent-comment navigation can open another expense panel above the thread. Its Back button then pops that panel, revealing the thread instead of Spend.
The header interprets that value as ordinary history-back, consistent with returning to the thread: ReportHeader.tsx:60–82.
However, the helper already checks whether the original expense is immediately below the thread. If found, it updates that expense and pops the thread rather than opening another panel: ReportUtils.ts:12440–12452. That should prevent the reported behavior in the straightforward stack.
The unresolved question is why this protection misses in the affected flow. A different stack shape or deployed implementation remains possible.
Required before recommending a fix: Capture the active panel stack, ancestor report ID, and selected navigation branch immediately before and after clicking the parent comment. This will distinguish a missed existing-expense match from a different navigation failure. Add regression coverage for the complete sequence through the final Back action; reverting type annotations is not supported by the evidence.
Reproduced on staging web. The route IDs show the cause directly:
Spend > Expenses → expense: /search/view/6668534542846014?anchorTransactionID=... (the expense report).
Comment → Reply in thread: /search/view/5808396084513355 (the thread).
Click the parent comment: a new screen /search/view/8951406895024852/<reportActionID>?backTo=SearchReport is pushed. 8951406895024852 is the expense's one-transaction thread, not the expense report below.
< → back on the thread (5808396084513355) instead of Spend > Expenses.
What is the root cause of that problem?
When the user clicks the parent comment, AncestorReportActionItem calls navigateToLinkedReportAction. In the RHP it already has a guard for this exact flow: if the route under the thread is the ancestor's report, it updates that route and pops the thread instead of pushing a new screen:
The guard misses because of one-expense reports. Opening an expense from Spend > Expenses opens SEARCH_REPORT with the expense report's ID (/search/view/<expenseReportID>?anchorTransactionID=...). In that combined view, comments are posted to the one-transaction thread, not the expense report (useComposerReportData → getOneTransactionThreadReportID). So:
ancestor.report.reportID is the transaction thread ID.
routeBelow.params.reportID is the expense report ID, which is the transaction thread's parent.
They never match. The code falls through to Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: <transaction thread>, ...})) and pushes a third screen on top of the thread. Pressing < on that screen pops back to the thread, which is the reported bug.
What changes do you think we should make in order to solve the problem?
In navigateToLinkedReportAction, make the existing "route below" guard also recognize the expense report that displays the ancestor transaction thread:
Compute isAncestorShownInRouteBelow:
true if routeBelowParams.reportID === ancestor.report.reportID (today's case);
or if the ancestor is a transaction thread (isReportTransactionThread(ancestor.report)) and routeBelowParams.reportID === ancestor.report.parentReportID, i.e. the screen below is the one-expense report that renders that thread's actions.
When it's true, keep today's behaviour: setParams({reportActionID}) on the route below so the combined view scrolls to and highlights the parent comment, then Navigation.goBack() to pop the thread.
Everything else is unchanged:
Multi-expense reports and other ancestors still push SEARCH_REPORT as today.
The wide-layout (non-RHP) branch is unchanged.
After the fix: thread → click parent comment → back on the expense with the comment highlighted → < returns to Spend > Expenses.
Tests (unit tests for navigateToLinkedReportAction with a mocked RHP state):
Route below = expense report and ancestor = its one-transaction thread: setParams on the route below plus goBack, and no navigate.
Route below = same report ID as the ancestor: same as above (existing behaviour preserved).
Route below is an unrelated report: navigate(SEARCH_REPORT) as today.
Ancestor is a non-transaction-thread report whose parentReportID matches the route below: still navigate (the new branch only applies to transaction threads).
What alternative solutions did you explore? (Optional)
Change the backTo / back-button handling in ReportHeader so < skips the thread. That treats the symptom: the extra screen would still be pushed, and the stack would keep a duplicate expense screen.
Navigate with the expense report ID instead of the thread ID in the fallback. That still pushes a duplicate of the screen already below. Reusing the route below, like the existing guard does, is cleaner.
The "already open below" guard in navigateToLinkedReportAction compares the wrong report IDs when an expense was opened from Spend > Expenses and belongs to a single-expense report, so clicking the parent comment pushes a duplicate RHP screen instead of popping back.
Spend opens the expense report, not the transaction thread. For a single-expense report, the Spend list keeps reportID = transactionItem.reportID (the expense report) and only switches to reportAction.childReportID (the transaction thread) for self-DM or multi-expense reports: Search/index.tsx#L787-L794. It then opens SEARCH_REPORT with that expense report ID: Search/index.tsx#L898-L910.
Comments are stored on the transaction thread. In that combined single-expense view, the composer writes comments to effectiveTransactionThreadReportID ?? reportID: useComposerSubmit.ts#L51-L52 via useComposerReportData.ts#L32-L35. "Reply in thread" therefore creates a child of the transaction thread and pushes it as another SEARCH_REPORT onto the same RHP (Report/index.ts#L3055-L3061), leaving the RHP stack as [SEARCH_REPORT(expenseReportID), SEARCH_REPORT(commentThreadID)].
The guard misses. Clicking the parent comment (AncestorReportActionItem.tsx#L124-L139) calls navigateToLinkedReportAction, whose guard only goes back when routeBelowParams.reportID === ancestor.report.reportID (ReportUtils.ts#L12440-L12452). Here ancestor.report is the transaction thread, whereas routeBelow holds its parent expense report, so the IDs differ and the fallback pushes SEARCH_REPORT({reportID: transactionThreadID, reportActionID, backTo: SEARCH_REPORT}) (ReportUtils.ts#L12454-L12461).
The duplicate screen is not redirected away.OneTransactionThreadRedirectHandler deliberately skips routes that include reportActionID (OneTransactionThreadRedirectHandler.tsx#L86-L91), so the pushed transaction-thread screen remains above the comment thread. Its header Back button sees backTo === SCREENS.RIGHT_MODAL.SEARCH_REPORT and calls plain Navigation.goBack() (ReportHeader.tsx#L65-L68), returning to the comment thread instead of Spend > Expenses.
This also explains why the guard already works for multi-expense reports and self-DM expenses: in those flows Spend opens the transaction thread itself, so the IDs match.
What changes do you think we should make in order to solve the problem?
In navigateToLinkedReportAction (ReportUtils.ts#L12440-L12452), extend the "ancestor is already open below" check to also recognize the combined single-expense report case:
Keep the existing exact match (routeBelowParams.reportID === ancestor.report.reportID).
Also treat routeBelow as a match when routeBelowParams.reportID === ancestor.report.parentReportIDandancestor.report is specifically that parent's one-transaction thread, verified with the existing isOneTransactionThread(ancestor.report, parentReport, parentReportAction) helper (ReportUtils.ts#L3053-L3071) using the Onyx report and parent report action lookups already in ReportUtils. Checking isOneTransactionThread rather than only isReportTransactionThread is critical so a multi-expense parent report sitting below in the RHP (which does not render its child transaction threads' comments inline) does not false-match and pop away from the transaction thread.
When either condition matches, keep the existing behavior: call setParams({reportActionID}) on routeBelow so the combined single-expense view scrolls to and highlights the parent comment, then call Navigation.goBack(). The RHP stack cleanly returns to [SEARCH_REPORT(expenseReportID)], and tapping < closes the RHP back to Spend > Expenses.
No changes are needed in ReportHeader, OneTransactionThreadRedirectHandler, or Search/index.tsx, preserving multi-expense/self-DM flows, reportActionID deep links, and the non-RHP (isInNarrowPaneModal === false) path.
Add unit test coverage for navigateToLinkedReportAction verifying:
RHP stack [SEARCH_REPORT(singleExpenseParentReport), SEARCH_REPORT(commentThread)] with a one-transaction-thread ancestor calls setParams + goBack and does not call navigate.
RHP stack where routeBelow is a multi-expense parent report (not a one-transaction thread) still falls through to navigate instead of popping back to the parent report.
Existing exact-ID match and unrelated-report cases remain unchanged.
What alternative solutions did you explore? (Optional)
Checking only isReportTransactionThread(ancestor.report) with parentReportID: Rejected because any transaction thread under a multi-expense report also passes isReportTransactionThread, which would falsely pop back to a multi-expense parent report that does not render that transaction's comments inline.
Letting OneTransactionThreadRedirectHandler redirect even when reportActionID is set: Rejected because the redirected screen would still sit above the comment thread on the RHP stack (so Back would still land on the thread) and it would regress comment deep links into one-transaction threads.
Altering ReportHeader Back behavior for backTo === SEARCH_REPORT: Rejected because it masks the duplicate screen on the stack and would break legitimate report-to-report back navigation in Search.
@samranahm Melvin's analysis leaves open why the route-below check in navigateToLinkedReportAction misses, and the answer is the IDs: for a one-expense report, Spend opens the RHP on the expense report's reportID, not the transaction thread's:
So in the reply thread ancestor.report is the transaction thread, the reportID comparison fails, and the fallback pushes a SEARCH_REPORT for it with backTo: SCREENS.RIGHT_MODAL.SEARCH_REPORT, whose Back pops straight to the thread; I tested this locally — after clicking the parent comment the RHP stack is [expense report, thread, transaction thread], and Back lands on the thread. Treating the route below as a match when it is the one-expense parent of ancestor.report (its parentReportID) and just popping back to it fixes this inside that one helper, without touching Search or the composer.
Happy to put up a full proposal for this if that's useful.
Please re-state the problem that we are trying to solve in this issue.
From Spend > Expenses, opening an expense that has a comment, replying in thread, clicking the parent comment, and then tapping the "<" back button on the expense detail RHP takes the user to the comment thread instead of back to the Spend > Expenses list.
What is the root cause of that problem?
The "ancestor is already open below" guard in navigateToLinkedReportAction (src/libs/ReportUtils.ts) only compares exact report IDs, and it misses in the one-expense case. Verified on baseline e91964cb:
Spend opens the expense report, not the transaction thread, for a one-expense report. Search/index.tsx only switches reportID to the transaction thread's childReportID for self-DM or multi-expense reports, so a one-expense report opens SEARCH_REPORT with the expense report's ID.
Comments in that combined view are written to the transaction thread, not the expense report (useComposerReportData resolves effectiveTransactionThreadReportID, and useComposerSubmit targets it). "Reply in thread" therefore pushes a second SEARCH_REPORT for the comment thread on top of the expense report.
Clicking the parent comment calls navigateToLinkedReportAction with ancestor.report set to the transaction thread. The RHP guard only pops back when routeBelowParams.reportID === ancestor.report.reportID, but the route below holds the transaction thread's parent expense report, so the IDs differ and the code falls through to pushing a third screen: SEARCH_REPORT for the transaction thread with backTo: SEARCH_REPORT.
That third screen keeps its reportActionID, so OneTransactionThreadRedirectHandler deliberately skips redirecting it, and its header Back button sees backTo === SEARCH_REPORT and calls plain Navigation.goBack(), landing on the comment thread. That is the reported bug.
What changes do you think we should make in order to solve the problem?
In navigateToLinkedReportAction, extend the RHP "already open below" guard to also recognize the one-expense parent below, in src/libs/ReportUtils.ts only:
Keep the existing exact match (routeBelowParams.reportID === ancestor.report.reportID), with its current behaviour of setting reportActionID on the route below and going back.
Also treat the route below as a match when routeBelowParams.reportID === ancestor.report.parentReportIDand the ancestor is that parent's one-transaction thread, verified with the existing isOneTransactionThread(ancestor.report, parentReport, parentReportAction, isOffline) helper. The parent report and parent report action are looked up the same way getDisplayedReportID already does in this file (deprecatedAllReports and getReportAction), and isOffline is passed through for the deleted-IOU offline edge. Using isOneTransactionThread rather than only isReportTransactionThread matters: any transaction thread passes isReportTransactionThread, so that check alone would wrongly pop back to a multi-expense parent report that does not render the thread's comments inline. With the stricter check, a multi-expense parent still falls through to pushing a new screen, as today.
When the one-transaction parent matches, just call Navigation.goBack() with no setParams. The parent comment is an action on the transaction thread, not on the expense report, so setting its reportActionID on the expense report route cannot scroll to or highlight it: LinkedActionNotFoundGate looks the action up only in the expense report's actions and finds nothing, and neither scroll hook finds it in the expense report's rendered actions, so there is no scroll target. Popping back without the param lands on the expense report as it was, and tapping "<" there returns to Spend > Expenses.
No changes are needed in ReportHeader, OneTransactionThreadRedirectHandler, or Search/index.tsx, and the non-RHP (wide layout) branch is unchanged.
Tests added in tests/unit/NavigateToLinkedReportActionTest.ts (Given/When/Then style, RHP stack mocked through navigationRef): the one-expense parent below pops back with no navigate and no setParams; a multi-expense parent below still pushes a new screen for the thread; the existing exact-ID match still sets reportActionID and pops back; an unrelated route below still pushes a new screen; and a missing parent report in Onyx safely falls through to pushing a new screen.
Evidence: the 5 new tests pass (5/5) and the first test fails on the clean baseline (the bug reproduces: navigate is called instead of goBack). oxlint reports 0 errors on the new test file and no new errors on ReportUtils.ts (137 pre-existing errors on the file before and after the change, none on the changed lines); spell check clean; React Compiler compliance check passed. Full typecheck could not be run on this machine: the TypeScript compiler process is killed before emitting diagnostics (a known limitation of this 6 GB VM; no diagnostics were emitted before the process was killed); the changes keep their declared types and the type-aware lint rules pass on all changed files.
This pops back to the expense report as it was, without scrolling to or highlighting the parent comment, which lives on the transaction thread.
What alternative solutions did you explore? (Optional)
Checking only isReportTransactionThread(ancestor.report) with parentReportID: Rejected because any transaction thread under a multi-expense report also passes isReportTransactionThread, which would falsely pop back to a multi-expense parent report that does not render that transaction's comments inline. The new unit test for the multi-expense parent proves this distinction.
Setting reportActionID on the expense report route below so the combined view scrolls to the parent comment: Rejected because the comment is not in the expense report's actions collection, so no scroll target exists: LinkedActionNotFoundGate looks it up only in the expense report's actions and finds nothing, and neither scroll hook finds it in the expense report's rendered actions. Popping back without the param avoids that churn.
Altering ReportHeader Back behavior for backTo === SEARCH_REPORT: Rejected because it masks the duplicate screen on the stack and would break legitimate report-to-report back navigation in Search.
Letting OneTransactionThreadRedirectHandler redirect even when reportActionID is set: Rejected because the redirected screen would still sit above the comment thread on the RHP stack (so Back would still land on the thread) and it would regress comment deep links into one-transaction threads.
@Xch4rt@colton-summerlin@dankezo@kevinjosh10 Thank you all for your interest in contributing to Expensify! Please only post proposal if Help Wanted label has been applied. Also, take a look at CONTRIBUTING.md to get familiar with the guidelines.
When a single-transaction expense is opened from Spend > Expenses, Search (src/components/Search/index.tsx) opens SCREENS.RIGHT_MODAL.SEARCH_REPORT using the parent expense report ID (transactionItem.reportID) rather than the one-transaction thread ID (transactionItem.reportAction.childReportID).
Because comments belong to the one-transaction thread (ancestor.report.reportID), replying in a thread and clicking the parent comment invokes navigateToLinkedReportAction (src/libs/ReportUtils.ts), whose reuse check compares routeBelowParams?.reportID === ancestor.report.reportID. Since routeBelow holds the parent expense report ID while ancestor.report.reportID is the one-transaction thread ID, the check fails and pushes a duplicate SEARCH_REPORT screen on top of the comment thread ([parentExpenseReport, commentThread, oneTransactionThread]). Tapping < then pops back to the comment thread instead of Spend > Expenses.
What changes do you think we should make in order to solve the problem?
In navigateToLinkedReportAction (src/libs/ReportUtils.ts), reuse the existing getDisplayedReportID(ancestor.report.reportID, isOffline) helper (which already delegates to isOneTransactionThread) when checking if routeBelow is already displaying the ancestor report, gated specifically to SCREENS.RIGHT_MODAL.SEARCH_REPORT:
Treat routeBelow as matching when routeBelowParams?.reportID === ancestor.report.reportID, or when routeBelow?.name === SCREENS.RIGHT_MODAL.SEARCH_REPORT and routeBelowParams?.reportID === getDisplayedReportID(ancestor.report.reportID, isOffline).
When matched, update reportActionID on routeBelow via Navigation.setParams and call Navigation.goBack().
Scoping the getDisplayedReportID fallback strictly to SCREENS.RIGHT_MODAL.SEARCH_REPORT ensures:
From Spend > Expenses, the comment thread pops cleanly, the parent comment is highlighted on the already-open ReportScreen, and tapping < returns directly to Spend > Expenses.
From Spend > Reports / Home (SEARCH_MONEY_REQUEST_REPORT / EXPENSE_REPORT, rendered by SearchMoneyRequestReportPage, which does not consume route.params.reportActionID), existing navigation and comment-highlight behavior is preserved without regression.
Add unit tests in tests/unit/ReportUtilsTest.ts covering both SEARCH_REPORT (reuses routeBelow + goBack) and SEARCH_MONEY_REQUEST_REPORT (keeps current behavior).
What alternative solutions did you explore? (Optional)
Matching getDisplayedReportID regardless of routeBelow.name: rejected because SearchMoneyRequestReportPage does not read route.params.reportActionID, which would drop linked-comment scrolling/highlighting from Spend > Reports and Home.
Changing Search (src/components/Search/index.tsx) to open single-transaction expenses by childReportID: higher blast radius across Search RHP navigation flows than handling the displayed-report mapping in navigateToLinkedReportAction.
📣 @trangiaphatcty-a11y! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Please re-state the problem that we are trying to solve in this issue.
From Spend > Expenses, open a single-expense workspace report, choose Reply in thread on a comment, and tap the parent comment in the thread. This should reveal and highlight that comment in the original expense panel. Tapping < should then return to Spend > Expenses. It currently reopens the reply thread.
What is the root cause of that problem?
Search opens SEARCH_REPORT with the expense report ID for a single-expense workspace report. useReportActionsPagination renders the transaction thread’s comments inline via getCombinedReportActions. Those comments still belong to the transaction thread in Onyx. useOriginalReportID confirms that ownership by looking up the action in the resolved thread’s collection. src/components/Search/index.tsx:793–802, src/hooks/useReportActionsPagination.ts:97–104, src/hooks/useOriginalReportID.ts:51–81
In the narrow-pane branch, navigateToLinkedReportAction compares routeBelowParams?.reportID with ancestor.report.reportID. The former is the expense report and the latter is the transaction thread. The comparison fails, so Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute(...)) opens a linked report above the reply. Back exposes the reply again. src/libs/ReportUtils.ts:12653–12682
What changes do you think we should make in order to solve the problem?
Reuse the original SEARCH_REPORT route and give the linked-action anchor an explicit owner.
In navigateToLinkedReportAction, keep the direct report-ID match. For a merged match, require a SCREENS.RIGHT_MODAL.SEARCH_REPORT destination, transactionCount === 1, and an exact match between its resolved inline transaction thread and ancestor.report.reportID. Share the inline-thread selection used by useTransactionThread, including filtered report actions and isOffline. This matters when a deleted sibling still has replies or the cache holds only part of a multi-expense report. If the relationship is unresolved, use the existing linked-report navigation. src/libs/ReportUtils.ts:12660–12681, src/hooks/useReportActionsPagination.ts:40–71
Set the existing reportActionID and a proposed optional reportActionOwnerReportID together on the destination route using Navigation.setParams. Preserve its reportID and backTo, then pop the reply. For nested replies, pop only the contiguous chain whose parentReportID links lead back to the owning thread. Use the existing fallback if an unrelated route interrupts that chain. Clear the optional owner when setting a regular direct-match anchor so a previous inline selection cannot affect it. src/libs/ReportUtils.ts:12660–12681
In useReportActionsPagination, pass a merged anchor to the transaction thread’s action loading only when the owner matches the resolved transactionThreadReportID. Keep the expense report’s usePaginatedReportActions on its normal anchor. Use the merged persistedReportActionIDs for membership validation and retain the selected ID while its owning collection is loading. This lets cached comments and visible optimistic comments use the same path offline, with the existing loading and missing-action behavior for uncached targets. src/hooks/useReportActionsPagination.ts:53–66, src/hooks/useReportActionsPagination.ts:97–120
The regression check should assert both the highlight and the next Back destination. I would cover immediate and nested replies, a cached offline comment, an optimistic reply, a deleted sibling with retained replies, a multi-expense report, and the Spend > Reports and Home entry points.
What alternative solutions did you explore? (Optional)
The reported reportActionID-only attempt fixed Back but lost the highlight. The pagination hook explains the gap: it passes the route anchor to usePaginatedReportActions(reportID, ...) before it merges the thread comments. The owner parameter lets the existing destination direct the anchor to the right collection without a separate reveal provider. src/hooks/useReportActionsPagination.ts:53–66
📣 @phamdat30423! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Hey @samranahm , whenever you get a chance to review this issue, could you also make sure to check the nested thread case? It's part of the same class of bug as the simple thread issue and should be fixed as part of this as well.
Please re-state the problem that we are trying to solve in this issue.
From Spend > Expenses, when a user opens an expense, opens a comment via "Reply in thread", clicks the parent comment in chat history, and then taps the < back button on the expense detail RHP, the app navigates back to the comment thread instead of returning to Spend > Expenses. Clicking the parent comment should also keep the target comment highlighted on the expense screen.
Opening a single-expense report from Spend > Expenses pushes SEARCH_REPORT (or SEARCH_MONEY_REQUEST_REPORT) with the expense report ID (R), while inline comments live in its one-transaction thread (T).
Clicking the parent comment in the reply thread calls navigateToLinkedReportAction() (src/libs/ReportUtils.ts), which only checks routeBelowParams?.reportID === ancestor.report.reportID. Because R !== T, the check misses and pushes a third RHP screen (SEARCH_REPORT for T with backTo: SEARCH_REPORT). Tapping < then pops back to the reply thread instead of Spend > Expenses.
Reusing routeBelow with reportID: R and reportActionID breaks pagination and guard validation (usePaginatedReportActions.ts & LinkedActionNotFoundGuard.tsx):
Simply calling Navigation.setParams({reportActionID}) on routeBelow (which keeps reportID: R) causes usePaginatedReportActions(R, reportActionID) to pass reportActionID (an action belonging to thread T) into getContinuousChain over R's report actions, returning an empty chain [] and blanking out the action list / WideRHPReceiptPanel.
At the same time, LinkedActionNotFoundGuard (src/pages/inbox/LinkedActionNotFoundGuard.tsx) looks up reportActionIDFromRoute only in ${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportIDFromRoute} (R), concludes the linked action does not exist, and clears reportActionID via Navigation.setParams({reportActionID: undefined}), preventing the parent comment from staying highlighted.
What changes do you think we should make in order to solve the problem?
Reuse routeBelow for one-transaction threads in navigateToLinkedReportAction() (src/libs/ReportUtils.ts):
In the isInNarrowPaneModal branch of navigateToLinkedReportAction(), match routeBelow not only when routeBelowParams?.reportID === ancestor.report.reportID, but also when routeBelowParams?.reportID refers to a single-transaction report whose one-transaction thread ID equals ancestor.report.reportID (using getDisplayedReportID / one-transaction thread lookup when transaction count is 1).
When matched, keep routeBelow's existing reportID (R) and set only {reportActionID: ancestor.reportAction.reportActionID} via Navigation.setParams(..., routeBelow.key, rhpState?.key) followed by Navigation.goBack(), without introducing any new route param. Because routeBelow stays on R, the report header (MoneyReportHeader) and carousel state remain intact, and tapping < returns directly to Spend > Expenses (or Spend > Reports).
Resolve one-transaction thread linked actions in pagination and LinkedActionNotFoundGuard:
In src/hooks/usePaginatedReportActions.ts, when reportActionID is not found in sortedAllReportActions for reportID (R) and reportID is displaying a one-transaction thread (T), do not use reportActionID as the pagination anchor for R's own getContinuousChain (so R's actions and WideRHPReceiptPanel stay populated while T's inline list highlights reportActionID).
In src/pages/inbox/LinkedActionNotFoundGuard.tsx, when the route's reportID is a one-transaction report and linkedAction is not found in reportActions_${reportID}, also check reportActions_${oneTransactionThreadReportID} (and its loading state) before treating the linked action as unavailable or clearing reportActionID.
What alternative solutions did you explore? (Optional)
Retargeting routeBelow's reportID from R to T via Navigation.setParams({reportID: T, reportActionID}): Replaces the workspace expense report view with the transaction thread view, swapping MoneyReportHeader (Submit/Approve/Pay actions) for MoneyRequestHeader, breaking Spend > Reports (SEARCH_MONEY_REQUEST_REPORT), and risking OneTransactionThreadRedirectHandler / carousel state regressions.
Popping without setting reportActionID: Fixes the back button target but drops comment highlighting when returning to the parent comment, which the reviewer already noted as a regression.
⚠️@phamdat30423 Thanks for your interest. To be considered for this job, please post a proposal following the proposal template (note the mandatory sections). Comments claiming the job without one are not reviewed.
Please re-state the problem that we are trying to solve in this issue.
In Spend, after opening an expense, choosing "Reply in thread" on a comment and clicking the parent comment, the app pushes a new screen instead of going back to the expense. So pressing "<" on the expense RHP shows the comment thread again instead of the Spend > Expenses list.
What is the root cause of that problem?
A one-expense report screen keeps the expense reportR as its route, but shows the comments of its single transaction threadT inline. The comment A that was replied to lives in T, so the reply thread's ancestor is {report: T, reportAction: A}.
In navigateToLinkedReportAction (ReportUtils.ts), the RHP branch only goes back when routeBelow.params.reportID === ancestor.report.reportID. Here that is R === T, which is false, so it falls through to Navigation.navigate(SEARCH_REPORT(T)) and pushes a new screen.
Simply going back and setting reportActionID = A on the R route is not enough either: usePaginatedReportActions, ReportFetchHandler and LinkedActionNotFoundGuard all look for A in R's actions, don't find it, and clear the highlight. SearchMoneyRequestReportPage also doesn't accept reportActionID in its route params.
What changes do you think we should make in order to solve the problem?
In navigateToLinkedReportAction, treat an RHP report route as a match when it is a one-transaction report whose displayed thread is the ancestor report (reuse isOneTransactionReport / getOneTransactionThreadReportID, ignoring deleted IOU actions). Walk back through contiguous thread screens in the RHP so nested replies also work, set reportActionID on the matched route and go back (pop N screens for nested threads).
Add a small shared helper/hook that, given R and a reportActionID, tells whether that action belongs to R's inline transaction thread.
Use it in usePaginatedReportActions (don't anchor R's pagination on A; return A as the linked action), ReportFetchHandler (don't send T's action ID to openReport(R) or clear it) and LinkedActionNotFoundGuard (validate A against T).
Add optional reportActionID to the SEARCH_MONEY_REQUEST_REPORT and EXPENSE_REPORT route params, and wrap SearchMoneyRequestReportPage in LinkedActionNotFoundGuard.
Add unit tests for the navigation helper, the pagination hook and the guard.
The screen keeps report R, so the expense-report header, actions and next-step banner stay as they are.
What alternative solutions did you explore? (Optional)
Replace the route's reportID with T: the comment is found, but the screen turns into a transaction-thread view and loses the expense report header, actions and Spend > Reports behaviour.
Only set reportActionID on the route below: pagination, fetching and the not-found guard can't find A in R, so the highlight is cleared right away.
AI disclosure: I used an AI assistant (Claude) to investigate the code and draft this proposal.
📣 @ookamitai! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors
Activity
applause-bot commentedon Nov 24, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/5f7e8c84105c84b45d22db98be90a54503b6b053695ee98d60d1e422cfbf5f34
expensify-chore-bot commentedon Nov 24, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @samranahm (
External)[-]Reports- Tap back button on RHP navigate to thread instead of Spend - Expenses[/-][+][$175] Reports- Tap back button on RHP navigate to thread instead of Spend - Expenses[/+]expensify-chore-bot commentedon Nov 24, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022125097486422596139
MelvinBot commentedon Nov 24, 2026
🤖 Web test steps verification results:⚠️ partial
Created a disposable $1.07 expense and comment. Verification stopped at an unsupported right-click operation, so the reported navigation bug remains unverified.

Open Spend > Expenses
Initially empty; the disposable expense appeared after creation.Open an expense with an existing comment
Reopened the expense and confirmed its saved comment.Right-click comment → Reply in thread
Driver returned UNSUPPORTED_OPERATION for secondary-click; hovering exposed no reply action.Click the parent comment
Blocked before entering the thread.Click expense header Back → Spend > Expenses
Not executed from the required thread-origin state.Preliminary analysis — low confidence
Suspected mechanism: Parent-comment navigation can open another expense panel above the thread. Its Back button then pops that panel, revealing the thread instead of Spend.
Code evidence and important counterevidence
backTo: SearchReport: ReportUtils.ts:12454–12461.However, the helper already checks whether the original expense is immediately below the thread. If found, it updates that expense and pops the thread rather than opening another panel: ReportUtils.ts:12440–12452. That should prevent the reported behavior in the straightforward stack.
The unresolved question is why this protection misses in the affected flow. A different stack shape or deployed implementation remains possible.
The QA-linked unsafe-assertion refactor does not establish causation: its relevant header changes are type-only, and the Back behavior already existed before that merge.
Required before recommending a fix: Capture the active panel stack, ancestor report ID, and selected navigation branch immediately before and after clicking the parent comment. This will distinguish a missed existing-expense match from a different navigation failure. Add regression coverage for the complete sequence through the final Back action; reverting type annotations is not supported by the evidence.
view run · view recording
Xch4rt commentedon Nov 24, 2026
Proposal
Reproduced on staging web. The route IDs show the cause directly:
/search/view/6668534542846014?anchorTransactionID=...(the expense report)./search/view/5808396084513355(the thread)./search/view/8951406895024852/<reportActionID>?backTo=SearchReportis pushed.8951406895024852is the expense's one-transaction thread, not the expense report below.<→ back on the thread (5808396084513355) instead of Spend > Expenses.What is the root cause of that problem?
When the user clicks the parent comment,
AncestorReportActionItemcallsnavigateToLinkedReportAction. In the RHP it already has a guard for this exact flow: if the route under the thread is the ancestor's report, it updates that route and pops the thread instead of pushing a new screen:https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L12440-L12452
The guard misses because of one-expense reports. Opening an expense from Spend > Expenses opens
SEARCH_REPORTwith the expense report's ID (/search/view/<expenseReportID>?anchorTransactionID=...). In that combined view, comments are posted to the one-transaction thread, not the expense report (useComposerReportData→getOneTransactionThreadReportID). So:ancestor.report.reportIDis the transaction thread ID.routeBelow.params.reportIDis the expense report ID, which is the transaction thread's parent.They never match. The code falls through to
Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: <transaction thread>, ...}))and pushes a third screen on top of the thread. Pressing<on that screen pops back to the thread, which is the reported bug.What changes do you think we should make in order to solve the problem?
In
navigateToLinkedReportAction, make the existing "route below" guard also recognize the expense report that displays the ancestor transaction thread:isAncestorShownInRouteBelow:routeBelowParams.reportID === ancestor.report.reportID(today's case);isReportTransactionThread(ancestor.report)) androuteBelowParams.reportID === ancestor.report.parentReportID, i.e. the screen below is the one-expense report that renders that thread's actions.setParams({reportActionID})on the route below so the combined view scrolls to and highlights the parent comment, thenNavigation.goBack()to pop the thread.SEARCH_REPORTas today.After the fix: thread → click parent comment → back on the expense with the comment highlighted →
<returns to Spend > Expenses.Tests (unit tests for
navigateToLinkedReportActionwith a mocked RHP state):setParamson the route below plusgoBack, and nonavigate.navigate(SEARCH_REPORT)as today.parentReportIDmatches the route below: stillnavigate(the new branch only applies to transaction threads).What alternative solutions did you explore? (Optional)
backTo/ back-button handling inReportHeaderso<skips the thread. That treats the symptom: the extra screen would still be pushed, and the stack would keep a duplicate expense screen.colton-summerlin commentedon Nov 24, 2026
Proposal
What is the root cause of that problem?
The "already open below" guard in
navigateToLinkedReportActioncompares the wrong report IDs when an expense was opened from Spend > Expenses and belongs to a single-expense report, so clicking the parent comment pushes a duplicate RHP screen instead of popping back.reportID = transactionItem.reportID(the expense report) and only switches toreportAction.childReportID(the transaction thread) for self-DM or multi-expense reports: Search/index.tsx#L787-L794. It then opensSEARCH_REPORTwith that expense report ID: Search/index.tsx#L898-L910.effectiveTransactionThreadReportID ?? reportID: useComposerSubmit.ts#L51-L52 via useComposerReportData.ts#L32-L35. "Reply in thread" therefore creates a child of the transaction thread and pushes it as anotherSEARCH_REPORTonto the same RHP (Report/index.ts#L3055-L3061), leaving the RHP stack as[SEARCH_REPORT(expenseReportID), SEARCH_REPORT(commentThreadID)].navigateToLinkedReportAction, whose guard only goes back whenrouteBelowParams.reportID === ancestor.report.reportID(ReportUtils.ts#L12440-L12452). Hereancestor.reportis the transaction thread, whereasrouteBelowholds its parent expense report, so the IDs differ and the fallback pushesSEARCH_REPORT({reportID: transactionThreadID, reportActionID, backTo: SEARCH_REPORT})(ReportUtils.ts#L12454-L12461).OneTransactionThreadRedirectHandlerdeliberately skips routes that includereportActionID(OneTransactionThreadRedirectHandler.tsx#L86-L91), so the pushed transaction-thread screen remains above the comment thread. Its header Back button seesbackTo === SCREENS.RIGHT_MODAL.SEARCH_REPORTand calls plainNavigation.goBack()(ReportHeader.tsx#L65-L68), returning to the comment thread instead of Spend > Expenses.This also explains why the guard already works for multi-expense reports and self-DM expenses: in those flows Spend opens the transaction thread itself, so the IDs match.
What changes do you think we should make in order to solve the problem?
In
navigateToLinkedReportAction(ReportUtils.ts#L12440-L12452), extend the "ancestor is already open below" check to also recognize the combined single-expense report case:routeBelowParams.reportID === ancestor.report.reportID).routeBelowas a match whenrouteBelowParams.reportID === ancestor.report.parentReportIDandancestor.reportis specifically that parent's one-transaction thread, verified with the existingisOneTransactionThread(ancestor.report, parentReport, parentReportAction)helper (ReportUtils.ts#L3053-L3071) using the Onyx report and parent report action lookups already inReportUtils. CheckingisOneTransactionThreadrather than onlyisReportTransactionThreadis critical so a multi-expense parent report sitting below in the RHP (which does not render its child transaction threads' comments inline) does not false-match and pop away from the transaction thread.setParams({reportActionID})onrouteBelowso the combined single-expense view scrolls to and highlights the parent comment, then callNavigation.goBack(). The RHP stack cleanly returns to[SEARCH_REPORT(expenseReportID)], and tapping<closes the RHP back to Spend > Expenses.No changes are needed in
ReportHeader,OneTransactionThreadRedirectHandler, orSearch/index.tsx, preserving multi-expense/self-DM flows,reportActionIDdeep links, and the non-RHP (isInNarrowPaneModal === false) path.Add unit test coverage for
navigateToLinkedReportActionverifying:[SEARCH_REPORT(singleExpenseParentReport), SEARCH_REPORT(commentThread)]with a one-transaction-thread ancestor callssetParams+goBackand does not callnavigate.routeBelowis a multi-expense parent report (not a one-transaction thread) still falls through tonavigateinstead of popping back to the parent report.What alternative solutions did you explore? (Optional)
isReportTransactionThread(ancestor.report)withparentReportID: Rejected because any transaction thread under a multi-expense report also passesisReportTransactionThread, which would falsely pop back to a multi-expense parent report that does not render that transaction's comments inline.OneTransactionThreadRedirectHandlerredirect even whenreportActionIDis set: Rejected because the redirected screen would still sit above the comment thread on the RHP stack (so Back would still land on the thread) and it would regress comment deep links into one-transaction threads.ReportHeaderBack behavior forbackTo === SEARCH_REPORT: Rejected because it masks the duplicate screen on the stack and would break legitimate report-to-report back navigation in Search.yusufdeveloper2903 commentedon Nov 24, 2026
@samranahm Melvin's analysis leaves open why the route-below check in
navigateToLinkedReportActionmisses, and the answer is the IDs: for a one-expense report, Spend opens the RHP on the expense report'sreportID, not the transaction thread's:App/src/components/Search/index.tsx
Lines 787 to 795 in d7c37c0
Comments typed in that combined view are written to the transaction thread instead:
App/src/pages/inbox/report/ReportActionCompose/useComposerSubmit.ts
Lines 51 to 52 in d7c37c0
So in the reply thread
ancestor.reportis the transaction thread, thereportIDcomparison fails, and the fallback pushes aSEARCH_REPORTfor it withbackTo: SCREENS.RIGHT_MODAL.SEARCH_REPORT, whose Back pops straight to the thread; I tested this locally — after clicking the parent comment the RHP stack is[expense report, thread, transaction thread], and Back lands on the thread. Treating the route below as a match when it is the one-expense parent ofancestor.report(itsparentReportID) and just popping back to it fixes this inside that one helper, without touching Search or the composer.Happy to put up a full proposal for this if that's useful.
dankezo commentedon Nov 24, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
From Spend > Expenses, opening an expense that has a comment, replying in thread, clicking the parent comment, and then tapping the "<" back button on the expense detail RHP takes the user to the comment thread instead of back to the Spend > Expenses list.
What is the root cause of that problem?
The "ancestor is already open below" guard in
navigateToLinkedReportAction(src/libs/ReportUtils.ts) only compares exact report IDs, and it misses in the one-expense case. Verified on baselinee91964cb:Search/index.tsxonly switchesreportIDto the transaction thread'schildReportIDfor self-DM or multi-expense reports, so a one-expense report opensSEARCH_REPORTwith the expense report's ID.useComposerReportDataresolveseffectiveTransactionThreadReportID, anduseComposerSubmittargets it). "Reply in thread" therefore pushes a secondSEARCH_REPORTfor the comment thread on top of the expense report.navigateToLinkedReportActionwithancestor.reportset to the transaction thread. The RHP guard only pops back whenrouteBelowParams.reportID === ancestor.report.reportID, but the route below holds the transaction thread's parent expense report, so the IDs differ and the code falls through to pushing a third screen:SEARCH_REPORTfor the transaction thread withbackTo: SEARCH_REPORT.reportActionID, soOneTransactionThreadRedirectHandlerdeliberately skips redirecting it, and its header Back button seesbackTo === SEARCH_REPORTand calls plainNavigation.goBack(), landing on the comment thread. That is the reported bug.What changes do you think we should make in order to solve the problem?
In
navigateToLinkedReportAction, extend the RHP "already open below" guard to also recognize the one-expense parent below, insrc/libs/ReportUtils.tsonly:routeBelowParams.reportID === ancestor.report.reportID), with its current behaviour of settingreportActionIDon the route below and going back.routeBelowParams.reportID === ancestor.report.parentReportIDand the ancestor is that parent's one-transaction thread, verified with the existingisOneTransactionThread(ancestor.report, parentReport, parentReportAction, isOffline)helper. The parent report and parent report action are looked up the same waygetDisplayedReportIDalready does in this file (deprecatedAllReportsandgetReportAction), andisOfflineis passed through for the deleted-IOU offline edge. UsingisOneTransactionThreadrather than onlyisReportTransactionThreadmatters: any transaction thread passesisReportTransactionThread, so that check alone would wrongly pop back to a multi-expense parent report that does not render the thread's comments inline. With the stricter check, a multi-expense parent still falls through to pushing a new screen, as today.Navigation.goBack()with nosetParams. The parent comment is an action on the transaction thread, not on the expense report, so setting itsreportActionIDon the expense report route cannot scroll to or highlight it:LinkedActionNotFoundGatelooks the action up only in the expense report's actions and finds nothing, and neither scroll hook finds it in the expense report's rendered actions, so there is no scroll target. Popping back without the param lands on the expense report as it was, and tapping "<" there returns to Spend > Expenses.No changes are needed in
ReportHeader,OneTransactionThreadRedirectHandler, orSearch/index.tsx, and the non-RHP (wide layout) branch is unchanged.Tests added in
tests/unit/NavigateToLinkedReportActionTest.ts(Given/When/Then style, RHP stack mocked throughnavigationRef): the one-expense parent below pops back with nonavigateand nosetParams; a multi-expense parent below still pushes a new screen for the thread; the existing exact-ID match still setsreportActionIDand pops back; an unrelated route below still pushes a new screen; and a missing parent report in Onyx safely falls through to pushing a new screen.Evidence: the 5 new tests pass (5/5) and the first test fails on the clean baseline (the bug reproduces:
navigateis called instead ofgoBack).oxlintreports 0 errors on the new test file and no new errors onReportUtils.ts(137 pre-existing errors on the file before and after the change, none on the changed lines); spell check clean; React Compiler compliance check passed. Fulltypecheckcould not be run on this machine: the TypeScript compiler process is killed before emitting diagnostics (a known limitation of this 6 GB VM; no diagnostics were emitted before the process was killed); the changes keep their declared types and the type-aware lint rules pass on all changed files.This pops back to the expense report as it was, without scrolling to or highlighting the parent comment, which lives on the transaction thread.
What alternative solutions did you explore? (Optional)
isReportTransactionThread(ancestor.report)withparentReportID: Rejected because any transaction thread under a multi-expense report also passesisReportTransactionThread, which would falsely pop back to a multi-expense parent report that does not render that transaction's comments inline. The new unit test for the multi-expense parent proves this distinction.reportActionIDon the expense report route below so the combined view scrolls to the parent comment: Rejected because the comment is not in the expense report's actions collection, so no scroll target exists:LinkedActionNotFoundGatelooks it up only in the expense report's actions and finds nothing, and neither scroll hook finds it in the expense report's rendered actions. Popping back without the param avoids that churn.ReportHeaderBack behavior forbackTo === SEARCH_REPORT: Rejected because it masks the duplicate screen on the stack and would break legitimate report-to-report back navigation in Search.OneTransactionThreadRedirectHandlerredirect even whenreportActionIDis set: Rejected because the redirected screen would still sit above the comment thread on the RHP stack (so Back would still land on the thread) and it would regress comment deep links into one-transaction threads.Contributor details
Your Expensify account email: dannyphan190@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~013b564a690d9bcdab
melvin-bot commentedon Nov 24, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
samranahm commentedon Nov 24, 2026
@Xch4rt @colton-summerlin @dankezo @kevinjosh10 Thank you all for your interest in contributing to Expensify! Please only post proposal if Help Wanted label has been applied. Also, take a look at CONTRIBUTING.md to get familiar with the guidelines.
64 remaining items
trangiaphatcty-a11y commentedon Dec 1, 2026
Proposal
What is the root cause of that problem?
When a single-transaction expense is opened from Spend > Expenses,
Search(src/components/Search/index.tsx) opensSCREENS.RIGHT_MODAL.SEARCH_REPORTusing the parent expense report ID (transactionItem.reportID) rather than the one-transaction thread ID (transactionItem.reportAction.childReportID).Because comments belong to the one-transaction thread (
ancestor.report.reportID), replying in a thread and clicking the parent comment invokesnavigateToLinkedReportAction(src/libs/ReportUtils.ts), whose reuse check comparesrouteBelowParams?.reportID === ancestor.report.reportID. SincerouteBelowholds the parent expense report ID whileancestor.report.reportIDis the one-transaction thread ID, the check fails and pushes a duplicateSEARCH_REPORTscreen on top of the comment thread ([parentExpenseReport, commentThread, oneTransactionThread]). Tapping<then pops back to the comment thread instead of Spend > Expenses.What changes do you think we should make in order to solve the problem?
In
navigateToLinkedReportAction(src/libs/ReportUtils.ts), reuse the existinggetDisplayedReportID(ancestor.report.reportID, isOffline)helper (which already delegates toisOneTransactionThread) when checking ifrouteBelowis already displaying the ancestor report, gated specifically toSCREENS.RIGHT_MODAL.SEARCH_REPORT:routeBelowas matching whenrouteBelowParams?.reportID === ancestor.report.reportID, or whenrouteBelow?.name === SCREENS.RIGHT_MODAL.SEARCH_REPORTandrouteBelowParams?.reportID === getDisplayedReportID(ancestor.report.reportID, isOffline).reportActionIDonrouteBelowviaNavigation.setParamsand callNavigation.goBack().Scoping the
getDisplayedReportIDfallback strictly toSCREENS.RIGHT_MODAL.SEARCH_REPORTensures:ReportScreen, and tapping<returns directly to Spend > Expenses.SEARCH_MONEY_REQUEST_REPORT/EXPENSE_REPORT, rendered bySearchMoneyRequestReportPage, which does not consumeroute.params.reportActionID), existing navigation and comment-highlight behavior is preserved without regression.tests/unit/ReportUtilsTest.tscovering bothSEARCH_REPORT(reusesrouteBelow+goBack) andSEARCH_MONEY_REQUEST_REPORT(keeps current behavior).What alternative solutions did you explore? (Optional)
getDisplayedReportIDregardless ofrouteBelow.name: rejected becauseSearchMoneyRequestReportPagedoes not readroute.params.reportActionID, which would drop linked-comment scrolling/highlighting from Spend > Reports and Home.Search(src/components/Search/index.tsx) to open single-transaction expenses bychildReportID: higher blast radius across Search RHP navigation flows than handling the displayed-report mapping innavigateToLinkedReportAction.melvin-bot commentedon Dec 1, 2026
📣 @trangiaphatcty-a11y! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
syedmustafan commentedon Dec 1, 2026
@samranahm
Proposal
Updated
phamdat30423 commentedon Dec 1, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
From Spend > Expenses, open a single-expense workspace report, choose Reply in thread on a comment, and tap the parent comment in the thread. This should reveal and highlight that comment in the original expense panel. Tapping
<should then return to Spend > Expenses. It currently reopens the reply thread.What is the root cause of that problem?
SearchopensSEARCH_REPORTwith the expense report ID for a single-expense workspace report.useReportActionsPaginationrenders the transaction thread’s comments inline viagetCombinedReportActions. Those comments still belong to the transaction thread in Onyx.useOriginalReportIDconfirms that ownership by looking up the action in the resolved thread’s collection. src/components/Search/index.tsx:793–802, src/hooks/useReportActionsPagination.ts:97–104, src/hooks/useOriginalReportID.ts:51–81In the narrow-pane branch,
navigateToLinkedReportActioncomparesrouteBelowParams?.reportIDwithancestor.report.reportID. The former is the expense report and the latter is the transaction thread. The comparison fails, soNavigation.navigate(ROUTES.SEARCH_REPORT.getRoute(...))opens a linked report above the reply. Back exposes the reply again. src/libs/ReportUtils.ts:12653–12682What changes do you think we should make in order to solve the problem?
Reuse the original
SEARCH_REPORTroute and give the linked-action anchor an explicit owner.navigateToLinkedReportAction, keep the direct report-ID match. For a merged match, require aSCREENS.RIGHT_MODAL.SEARCH_REPORTdestination,transactionCount === 1, and an exact match between its resolved inline transaction thread andancestor.report.reportID. Share the inline-thread selection used byuseTransactionThread, including filtered report actions andisOffline. This matters when a deleted sibling still has replies or the cache holds only part of a multi-expense report. If the relationship is unresolved, use the existing linked-report navigation. src/libs/ReportUtils.ts:12660–12681, src/hooks/useReportActionsPagination.ts:40–71reportActionIDand a proposed optionalreportActionOwnerReportIDtogether on the destination route usingNavigation.setParams. Preserve itsreportIDandbackTo, then pop the reply. For nested replies, pop only the contiguous chain whoseparentReportIDlinks lead back to the owning thread. Use the existing fallback if an unrelated route interrupts that chain. Clear the optional owner when setting a regular direct-match anchor so a previous inline selection cannot affect it. src/libs/ReportUtils.ts:12660–12681useReportActionsPagination, pass a merged anchor to the transaction thread’s action loading only when the owner matches the resolvedtransactionThreadReportID. Keep the expense report’susePaginatedReportActionson its normal anchor. Use the mergedpersistedReportActionIDsfor membership validation and retain the selected ID while its owning collection is loading. This lets cached comments and visible optimistic comments use the same path offline, with the existing loading and missing-action behavior for uncached targets. src/hooks/useReportActionsPagination.ts:53–66, src/hooks/useReportActionsPagination.ts:97–120The regression check should assert both the highlight and the next Back destination. I would cover immediate and nested replies, a cached offline comment, an optimistic reply, a deleted sibling with retained replies, a multi-expense report, and the Spend > Reports and Home entry points.
What alternative solutions did you explore? (Optional)
The reported
reportActionID-only attempt fixed Back but lost the highlight. The pagination hook explains the gap: it passes the route anchor tousePaginatedReportActions(reportID, ...)before it merges the thread comments. The owner parameter lets the existing destination direct the anchor to the right collection without a separate reveal provider. src/hooks/useReportActionsPagination.ts:53–66Rewriting the destination
reportIDto the thread ID would also resolve action ownership. That ID drives the report and transaction lookups inSearchMoneyRequestReportPageforSEARCH_MONEY_REQUEST_REPORTandEXPENSE_REPORT. Keeping the expense route’s identity preserves those lookups and the original Back destination. src/pages/Search/SearchMoneyRequestReportPage.tsx:62–90, src/pages/Search/SearchMoneyRequestReportPage.tsx:136–150melvin-bot commentedon Dec 1, 2026
📣 @phamdat30423! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
Abdukhamid000 commentedon Dec 1, 2026
@samranahm any updates?
neerajbachani commentedon Dec 1, 2026
Hey @samranahm , whenever you get a chance to review this issue, could you also make sure to check the nested thread case? It's part of the same class of bug as the simple thread issue and should be fixed as part of this as well.
I've attached a repro video below for reference.
Screen.Recording.2026-11-28.at.3.39.22.AM.online-video-cutter.com.mp4
chieens2104 commentedon Dec 1, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
From
Spend > Expenses, when a user opens an expense, opens a comment via"Reply in thread", clicks the parent comment in chat history, and then taps the<back button on the expense detail RHP, the app navigates back to the comment thread instead of returning toSpend > Expenses. Clicking the parent comment should also keep the target comment highlighted on the expense screen.What is the root cause of that problem?
There are two coupled issues:
RHP reuse check misses single-expense (one-transaction) reports (
src/libs/ReportUtils.ts):Spend > ExpensespushesSEARCH_REPORT(orSEARCH_MONEY_REQUEST_REPORT) with the expense report ID (R), while inline comments live in its one-transaction thread (T).navigateToLinkedReportAction()(src/libs/ReportUtils.ts), which only checksrouteBelowParams?.reportID === ancestor.report.reportID. BecauseR !== T, the check misses and pushes a third RHP screen (SEARCH_REPORTforTwithbackTo: SEARCH_REPORT). Tapping<then pops back to the reply thread instead ofSpend > Expenses.Reusing
routeBelowwithreportID: RandreportActionIDbreaks pagination and guard validation (usePaginatedReportActions.ts&LinkedActionNotFoundGuard.tsx):Navigation.setParams({reportActionID})onrouteBelow(which keepsreportID: R) causesusePaginatedReportActions(R, reportActionID)to passreportActionID(an action belonging to threadT) intogetContinuousChainoverR's report actions, returning an empty chain[]and blanking out the action list /WideRHPReceiptPanel.LinkedActionNotFoundGuard(src/pages/inbox/LinkedActionNotFoundGuard.tsx) looks upreportActionIDFromRouteonly in${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportIDFromRoute}(R), concludes the linked action does not exist, and clearsreportActionIDviaNavigation.setParams({reportActionID: undefined}), preventing the parent comment from staying highlighted.What changes do you think we should make in order to solve the problem?
Reuse
routeBelowfor one-transaction threads innavigateToLinkedReportAction()(src/libs/ReportUtils.ts):isInNarrowPaneModalbranch ofnavigateToLinkedReportAction(), matchrouteBelownot only whenrouteBelowParams?.reportID === ancestor.report.reportID, but also whenrouteBelowParams?.reportIDrefers to a single-transaction report whose one-transaction thread ID equalsancestor.report.reportID(usinggetDisplayedReportID/ one-transaction thread lookup when transaction count is 1).routeBelow's existingreportID(R) and set only{reportActionID: ancestor.reportAction.reportActionID}viaNavigation.setParams(..., routeBelow.key, rhpState?.key)followed byNavigation.goBack(), without introducing any new route param. BecauserouteBelowstays onR, the report header (MoneyReportHeader) and carousel state remain intact, and tapping<returns directly toSpend > Expenses(orSpend > Reports).Resolve one-transaction thread linked actions in pagination and
LinkedActionNotFoundGuard:src/hooks/usePaginatedReportActions.ts, whenreportActionIDis not found insortedAllReportActionsforreportID(R) andreportIDis displaying a one-transaction thread (T), do not usereportActionIDas the pagination anchor forR's owngetContinuousChain(soR's actions andWideRHPReceiptPanelstay populated whileT's inline list highlightsreportActionID).src/pages/inbox/LinkedActionNotFoundGuard.tsx, when the route'sreportIDis a one-transaction report andlinkedActionis not found inreportActions_${reportID}, also checkreportActions_${oneTransactionThreadReportID}(and its loading state) before treating the linked action as unavailable or clearingreportActionID.What alternative solutions did you explore? (Optional)
routeBelow'sreportIDfromRtoTviaNavigation.setParams({reportID: T, reportActionID}): Replaces the workspace expense report view with the transaction thread view, swappingMoneyReportHeader(Submit/Approve/Pay actions) forMoneyRequestHeader, breakingSpend > Reports(SEARCH_MONEY_REQUEST_REPORT), and riskingOneTransactionThreadRedirectHandler/ carousel state regressions.reportActionID: Fixes the back button target but drops comment highlighting when returning to the parent comment, which the reviewer already noted as a regression.samranahm commentedon Dec 2, 2026
I'll review this today.
phamdat30423 commentedon Dec 2, 2026
melvin-bot commentedon Dec 2, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
github-actions commentedon Dec 2, 2026
ookamitai commentedon Dec 3, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
In Spend, after opening an expense, choosing "Reply in thread" on a comment and clicking the parent comment, the app pushes a new screen instead of going back to the expense. So pressing "<" on the expense RHP shows the comment thread again instead of the Spend > Expenses list.
What is the root cause of that problem?
A one-expense report screen keeps the expense report
Ras its route, but shows the comments of its single transaction threadTinline. The commentAthat was replied to lives inT, so the reply thread's ancestor is{report: T, reportAction: A}.In
navigateToLinkedReportAction(ReportUtils.ts), the RHP branch only goes back whenrouteBelow.params.reportID === ancestor.report.reportID. Here that isR === T, which is false, so it falls through toNavigation.navigate(SEARCH_REPORT(T))and pushes a new screen.Simply going back and setting
reportActionID = Aon theRroute is not enough either:usePaginatedReportActions,ReportFetchHandlerandLinkedActionNotFoundGuardall look forAinR's actions, don't find it, and clear the highlight.SearchMoneyRequestReportPagealso doesn't acceptreportActionIDin its route params.What changes do you think we should make in order to solve the problem?
navigateToLinkedReportAction, treat an RHP report route as a match when it is a one-transaction report whose displayed thread is the ancestor report (reuseisOneTransactionReport/getOneTransactionThreadReportID, ignoring deleted IOU actions). Walk back through contiguous thread screens in the RHP so nested replies also work, setreportActionIDon the matched route and go back (pop N screens for nested threads).Rand areportActionID, tells whether that action belongs toR's inline transaction thread.usePaginatedReportActions(don't anchorR's pagination onA; returnAas the linked action),ReportFetchHandler(don't sendT's action ID toopenReport(R)or clear it) andLinkedActionNotFoundGuard(validateAagainstT).reportActionIDto theSEARCH_MONEY_REQUEST_REPORTandEXPENSE_REPORTroute params, and wrapSearchMoneyRequestReportPageinLinkedActionNotFoundGuard.The screen keeps report
R, so the expense-report header, actions and next-step banner stay as they are.What alternative solutions did you explore? (Optional)
reportIDwithT: the comment is found, but the screen turns into a transaction-thread view and loses the expense report header, actions and Spend > Reports behaviour.reportActionIDon the route below: pagination, fetching and the not-found guard can't findAinR, so the highlight is cleared right away.AI disclosure: I used an AI assistant (Claude) to investigate the code and draft this proposal.
melvin-bot commentedon Dec 3, 2026
📣 @ookamitai! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format: