App icon indicating copy to clipboard operation
App copied to clipboard

[Due for payment 2026-11-13] [$250] Spend - It's not here page when opening a split expense from chat filter

Open applause-bot[bot] opened this issue 1 month ago • 71 comments

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.10-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: https://test-management.browserstack.com/projects/2219752/folder/57529521/test-cases/41237507 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: MacOS Safari App Component: Left Hand Navigation (LHN)

Action Performed:

  1. Launch new Expensify logged on
  2. Go to a chat with a user and click on the plus icon > Split expense
  3. Add an amount an confirm
  4. Go to Spend > Expenses and click on Filters
  5. Select Type > Chat
  6. Scroll down until you find the original split expense and click on it

Expected Result:

The expense is opened on any correct view (Edit split expenses maybe) or it's not shown at all

Actual Result:

The error message "Hmm... it's not here" is not show

Workaround:

Unknown

Platforms:

  • [ ] Android: App
  • [ ] Android: mWeb Chrome
  • [ ] iOS: App
  • [ ] iOS: mWeb Safari
  • [ ] iOS: mWeb Chrome
  • [x] Windows: Chrome
  • [ ] MacOS: Chrome Safari

Screenshots/Videos

https://github.com/user-attachments/assets/871d5bb8-4eca-4dae-8d3f-4439905ef75d

View all open jobs on GitHub

Applause Internal Information Exported by: Svetlana Lazutkina Bug ID: 7287440

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

applause-bot[bot] avatar Oct 15 '26 20:10 applause-bot[bot]

While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/7489a3856e824a296460b9f6b90a269f2173a172824b50415f3dfd2a7b7518e4

applause-bot[bot] avatar Oct 15 '26 20:10 applause-bot[bot]

Proposal

What is the root cause of that problem?

In a Type: Chat search result, a split action renders its own preview card. Clicking that card runs the split branch of onPreviewPressed, which builds the split-details route without a base path:

ChatTransactionPreview.tsx:70-74

createDynamicRoute then appends split/<reportActionID> to the current route (createDynamicRoute.ts:83). On Spend that gives search/split/<reportActionID>. The Search root is not in SPLIT_BILL_DETAILS.entryScreens (ROUTES.ts:1745-1749). As a result, getStateFromPath rejects the match and falls back to the * NotFound screen (getStateFromPath.ts:46-75).

The non-split branch in the same handler already uses the Search-aware getReportRouteForCurrentContext. The split branch was never updated to match.

What changes do you think we should make in order to solve the problem?

In the split branch of ChatTransactionPreview, pass an explicit base path when Search is the focused full-screen route. Use ROUTES.SEARCH_REPORT for the chat that owns the action (reportID, which is already a prop). The result is search/view/<chatReportID>/split/<reportActionID>, which:

  • passes the entryScreens check, because SEARCH_REPORT is allowed
  • gives the split details page the reportID param it needs

Keep the current behavior when the preview is clicked inside a report or an RHP, where the active route is already a valid base.

Add a test: press a split preview rendered from a Search chat row, then expect a route under search/view/<reportID>/split/.

What alternative solutions did you explore? (Optional)

  • Disable the preview's own press inside Search chat rows. The row's onSelectRow would then open the chat at that action. This is simpler but doesn't open the split details.
  • Only add SCREENS.SEARCH.ROOT to entryScreens. This is not enough: the Search root has no reportID param, so withReportAndReportActionOrNotFound would still show not-found.
Investigation details
  • Search rows render through ReportActionItem. For a split IOU action, ActionContentRouter renders ChatTransactionPreview with shouldShowSplitPreview=true (ActionContentRouter.tsx:184-204). Regular IOU actions in a DM return null, so they have no inner card.
  • The card's PressableWithoutFeedback handles the click before the row's onSelectRow (TransactionPreview/index.tsx:102-105).
  • A click on the row outside the card opens SEARCH_REPORT for the DM, which loads correctly (Search/index.tsx:784-800).
  • Preserve Search context for expense previews made the non-split branch Search-aware but left the split branch unchanged.
  • I tried to reproduce this on web. The split $10.00 action appeared under Type: Chat, but clicking it caused no navigation, so I could not confirm the not-found screen in the app. The root cause above comes from reading the code, so confidence is medium.

Next Steps for Contributor+ team: To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/104161) to create a draft PR. To refine: @MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.


view run · view recording

MelvinBot avatar Oct 15 '26 20:10 MelvinBot

Triggered auto assignment to Contributor-plus team member for initial proposal review - @mkhutornyi (External)

melvin-bot[bot] avatar Oct 15 '26 20:10 melvin-bot[bot]

Job added to Upwork: https://www.upwork.com/jobs/~022110831219914409226

melvin-bot[bot] avatar Oct 15 '26 20:10 melvin-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

Opening a split expense preview from Search chat results (Spend > Expenses > Filters > Type > Chat) displays "Hmm... it's not here".

What is the root cause of that problem?

In ChatTransactionPreview.tsx:70-74, clicking a split preview calls createDynamicRoute without basePath.

When Search is active, createDynamicRoute defaults to getActiveRoute() (search), creating search/split/<reportActionID>. However, DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.entryScreens (ROUTES.ts:1745-1749) only allows REPORT and modal screens (SEARCH_REPORT, EXPENSE_REPORT). Because search is not an allowed entry screen and lacks reportID, navigation fails and renders NotFound.

What changes do you think we should make in order to solve the problem?

Pass ROUTES.SEARCH_REPORT.getRoute({reportID}) as basePath to createDynamicRoute when Search is the topmost full-screen route:

--- a/src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx
+++ b/src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx
@@ -71,3 +71,4 @@
                 onPreviewPressed={() => {
                     if (shouldShowSplitPreview) {
-                        Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.getRoute(action.reportActionID)));
+                        const basePath = isSearchTopmostFullScreenRoute() && reportID ? ROUTES.SEARCH_REPORT.getRoute({reportID}) : undefined;
                        Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.getRoute(action.reportActionID), basePath));
                         return;
                     }

What alternative solutions did you explore? (Optional)

None.

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0170d6b02e9440e604

camesenin avatar Oct 15 '26 20:10 camesenin

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Oct 15 '26 20:10 melvin-bot[bot]

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/janithad

Proposal

Please re-state the problem that we are trying to solve in this issue.

When opening a split expense preview from Search chat results (Spend > Expenses > Filters > Type > Chat), the app displays the "Hmm... it's not here" (NotFound) screen.


What is the root cause of that problem?

In src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx:70-74:

onPreviewPressed={() => {
    if (shouldShowSplitPreview) {
        Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.getRoute(action.reportActionID)));
        return;
    }
  1. Missing basePath in createDynamicRoute:
    When clicked from the Search screen, createDynamicRoute defaults to getActiveRoute(), which is /search. It constructs the dynamic route:
    /search/split/:reportActionID.

  2. Entry screen validation failure in getStateFromPath:
    In ROUTES.ts:1745-1749:

    SPLIT_BILL_DETAILS: {
        path: 'split/:reportActionID',
        entryScreens: [SCREENS.REPORT, SCREENS.RIGHT_MODAL.SEARCH_REPORT, SCREENS.RIGHT_MODAL.EXPENSE_REPORT, SCREENS.RIGHT_MODAL.SEARCH_MONEY_REQUEST_REPORT],
        getRoute: (reportActionID: string) => `split/${reportActionID}` as const,
    },
    

    SCREENS.SEARCH.ROOT (/search) is not in entryScreens and has no reportID parameter. Consequently, getStateFromPath rejects the dynamic route candidate and falls back to SCREENS.NOT_FOUND ("Hmm... it's not here").

  3. Inconsistency with non-split preview branch:
    In the same file (ChatTransactionPreview.tsx:90, 96), PR #92659 updated the non-split branches to use the Search-aware helper getReportRouteForCurrentContext({reportID: ...}). However, the split branch was overlooked and remained without a base route.


What changes do you think we should make in order to solve the problem?

In src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx:

Use the already-imported getReportRouteForCurrentContext helper to supply the basePath when reportID is present:

--- a/src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx
+++ b/src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx
@@ -70,5 +70,6 @@ function ChatTransactionPreview({action, reportID, chatReport, iouReport, shoul
                 onPreviewPressed={() => {
                     if (shouldShowSplitPreview) {
-                        Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.getRoute(action.reportActionID)));
+                        const baseReportRoute = reportID ? getReportRouteForCurrentContext({reportID}) : undefined;
+                        Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.getRoute(action.reportActionID), baseReportRoute));
                         return;
                     }

Why getReportRouteForCurrentContext is the superior, idiomatic approach:

  • Preserves Search filter state via backTo: getReportRouteForCurrentContext automatically computes backTo = Navigation.getActiveRoute() and routes to ROUTES.SEARCH_REPORT.getRoute({reportID, backTo}). When the user closes or navigates back from the split details screen, they return seamlessly to their filtered Search view with active filters intact.
  • DRY & Unified: It reuses the exact same pattern already imported and used on lines 90 and 96 for transaction threads without introducing redundant duplicate checks (isSearchTopmostFullScreenRoute) in the component.
  • Universal compatibility: When rendered inside a standard report, getReportRouteForCurrentContext returns ROUTES.REPORT_WITH_ID (r/:reportID), maintaining 100% existing functionality.

What alternative solutions did you explore? (Optional)

  • Directly passing ROUTES.SEARCH_REPORT.getRoute({reportID}): Suboptimal because omitting backTo breaks the back-navigation chain, causing the user to lose their current Search filter state upon dismissing the modal.
  • Adding SCREENS.SEARCH.ROOT to DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.entryScreens: Not viable because the root Search screen lacks a reportID parameter needed by split details.

janiya2 avatar Oct 15 '26 20:10 janiya2

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Oct 15 '26 20:10 melvin-bot[bot]

@mkhutornyi I reproduced the bug and noticed a key issue with MelvinBot's direction:

Melvin suggests manually building search/view/<reportID>/split/<reportActionID>, but completely leaves out backTo. PR #92659 introduced getReportRouteForCurrentContext specifically so previews opened from Search carry backTo to preserve active filters across page reloads and back navigation.

Also, we don't need to build routes manually. ChatTransactionPreview already imports and uses getReportRouteForCurrentContext for other actions. Using it only when Search is active (isSearchTopmostFullScreenRoute) fixes the bug, preserves Search filters on back navigation, and avoids adding unnecessary query parameters to normal chat URLs.

Repro demo

https://github.com/user-attachments/assets/63fc3542-dd27-48b1-b0d1-776ddef238a7

I have tested this fix locally. Would you like me to post the full proposal?

Fix demo

https://github.com/user-attachments/assets/58b88a0c-00da-4df5-8a70-c542c4414108

emkhalid avatar Oct 16 '26 08:10 emkhalid

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 opening a split expense preview from Search results (Spend > Expenses > Filters > Type > Chat), the application fails to resolve the route and renders the "Hmm... it's not here" (NotFound) screen.

What is the root cause of that problem?

In src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx (lines 70–74):

onPreviewPressed={() => {
    if (shouldShowSplitPreview) {
        Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.getRoute(action.reportActionID)));
        return;
    }
  1. createDynamicRoute was called without a basePath parameter. When omitted, createDynamicRoute falls back to getActiveRoute(). When opening the preview from Search, getActiveRoute() resolves to /search.
  2. This generates /search/split/:reportActionID.
  3. In DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.entryScreens:
    entryScreens: [SCREENS.REPORT, SCREENS.RIGHT_MODAL.SEARCH_REPORT, SCREENS.RIGHT_MODAL.EXPENSE_REPORT, SCREENS.RIGHT_MODAL.SEARCH_MONEY_REQUEST_REPORT]
    
    SCREENS.SEARCH.ROOT (/search) is not an allowed entry screen and has no reportID parameter. Consequently, getStateFromPath fails to match the dynamic route candidate and falls back to SCREENS.NOT_FOUND.
  4. While lines 90 and 96 in ChatTransactionPreview.tsx were already updated to use getReportRouteForCurrentContext({reportID: ...}) to properly contextualize transaction thread routes for Search, the split bill branch was omitted.

What changes do you think we should make in order to solve the problem?

In src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx: Supply baseReportRoute computed via getReportRouteForCurrentContext({reportID}) as the second argument to createDynamicRoute:

--- a/src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx
+++ b/src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx
@@ -69,7 +69,8 @@ function ChatTransactionPreview({action, reportID, chatReport, iouReport, should
                 transactionPreviewWidth={reportPreviewStyles.transactionPreviewStandaloneStyle.width}
                 onPreviewPressed={() => {
                     if (shouldShowSplitPreview) {
-                        Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.getRoute(action.reportActionID)));
+                        const baseReportRoute = reportID ? getReportRouteForCurrentContext({reportID}) : undefined;
+                        Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.getRoute(action.reportActionID), baseReportRoute));
                         return;
                     }
  • When clicked inside Search (isSearchTopmostFullScreenRoute()), getReportRouteForCurrentContext returns ROUTES.SEARCH_REPORT.getRoute({reportID, backTo}). The route resolves cleanly as a child of SearchReport with backTo preserved, allowing the user to dismiss split bill details and return directly to their filtered Search state.
  • When clicked inside standard Chat reports, getReportRouteForCurrentContext returns ROUTES.REPORT_WITH_ID.getRoute({reportID}), retaining 100% normal behavior.

Pre-coded and tested in branch: fix/104161-split-bill-details-search-base-route (https://github.com/jloa-dev/App/tree/fix/104161-split-bill-details-search-base-route).

What alternative solutions did you explore? (Optional)

Directly passing ROUTES.SEARCH_REPORT.getRoute({reportID}). However, that omits the active backTo query parameter provided automatically by getReportRouteForCurrentContext, which would cause users to lose their Search filters upon navigating back.

jloa-dev avatar Oct 17 '26 16:10 jloa-dev

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Oct 17 '26 16:10 melvin-bot[bot]

@mkhutornyi Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Oct 20 '26 21:10 melvin-bot[bot]

@mkhutornyi Still overdue 6 days?! Let's take care of this!

melvin-bot[bot] avatar Oct 22 '26 21:10 melvin-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

When opening a split expense preview from Search results (Spend > Expenses > Filters > Type > Chat), the app navigates to an invalid route and displays the "Hmm... it's not here" (NotFound) page instead of opening the split expense details.

What is the root cause of that problem?

  1. In src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx:75-79, pressing a split expense preview calls createDynamicRoute without a basePath:
    if (shouldShowSplitPreview) {
        Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.getRoute(action.reportActionID)));
        return;
    }
    
  2. When basePath is omitted, createDynamicRoute (src/libs/Navigation/helpers/dynamicRoutesUtils/createDynamicRoute.ts:83) resolves against getActiveRoute(). When pressing the split preview directly from a Search results row (SCREENS.SEARCH.ROOT), getActiveRoute() is search?q=..., producing search/split/<reportActionID>?q=....
  3. In getStateFromPath (src/libs/Navigation/helpers/getStateFromPath.ts:38-75), the focused route parsed from pathWithoutDynamicSuffix is SCREENS.SEARCH.ROOT, which is not in DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.entryScreens (src/ROUTES.ts:1750-1754: [SCREENS.REPORT, SCREENS.RIGHT_MODAL.SEARCH_REPORT, SCREENS.RIGHT_MODAL.EXPENSE_REPORT, SCREENS.RIGHT_MODAL.SEARCH_MONEY_REQUEST_REPORT]) and lacks the reportID required by the split details page (src/pages/iou/DynamicSplitBillDetailsPage.tsx:158,217). Consequently, getStateFromPath rejects the dynamic suffix and falls back to SCREENS.NOT_FOUND.
  4. Crucially, we must distinguish between two contexts when Search is the underlying fullscreen tab:
    • Pressed directly from a Search list row (isOnSearch === true via useIsOnSearch()): The active route is SCREENS.SEARCH.ROOT (search?q=...), which is not a valid entryScreen. Here we need getReportRouteForCurrentContext({reportID}) (src/libs/Navigation/helpers/getReportRouteForCurrentContext.ts:13-24), which returns ROUTES.SEARCH_REPORT.getRoute({reportID, backTo: Navigation.getActiveRoute()}) (search/view/<reportID>?backTo=...).
    • Pressed inside an already-open RHP report (SCREENS.RIGHT_MODAL.SEARCH_REPORT, EXPENSE_REPORT, SEARCH_MONEY_REQUEST_REPORT) or standard Chat report (SCREENS.REPORT), where isOnSearch === false: The active route is already a valid entryScreen (and in SEARCH_REPORT, getActiveRoute() is already search/view/<reportID>?backTo=<searchQuery>).
      • Calling getReportRouteForCurrentContext({reportID}) unconditionally would append a redundant backTo pointing to the current report route to standard chat split URLs and overwrite EXPENSE_REPORT / SEARCH_MONEY_REQUEST_REPORT RHP base paths.
      • Gating on isSearchTopmostFullScreenRoute() alone (instead of useIsOnSearch()) would still trigger inside an already-open SEARCH_REPORT RHP—because getTopmostFullScreenRoute() remains NAVIGATORS.SEARCH_FULLSCREEN_NAVIGATOR—causing getReportRouteForCurrentContext to set backTo = Navigation.getActiveRoute() (search/view/<reportID>...), replacing the Search return target with the current SEARCH_REPORT URL (an unnecessary nested return target).

What changes do you think we should make in order to solve the problem?

In src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx, use useIsOnSearch() from @components/Search/SearchScopeProvider (matching src/pages/inbox/report/ReportActionItem.tsx:281, src/pages/inbox/report/ReportActionItemSingle.tsx:81, and tests/ui/ChatTransactionPreviewTest.tsx:86) and pass getReportRouteForCurrentContext({reportID}) as basePath to createDynamicRoute when isOnSearch && reportID is truthy:

--- a/src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx
+++ b/src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx
@@ -1,5 +1,6 @@
 import {usePersonalDetails} from '@components/OnyxListItemProvider';
 import TransactionPreview from '@components/ReportActionItem/TransactionPreview';
+import {useIsOnSearch} from '@components/Search/SearchScopeProvider';
 
 import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
 import useOnyx from '@hooks/useOnyx';
@@ -49,6 +50,7 @@
     const styles = useThemeStyles();
     const StyleUtils = useStyleUtils();
     const {shouldUseNarrowLayout} = useResponsiveLayout();
+    const isOnSearch = useIsOnSearch();
     const personalDetail = useCurrentUserPersonalDetails();
     const personalDetails = usePersonalDetails();
     const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
@@ -74,7 +76,8 @@
                 transactionPreviewWidth={reportPreviewStyles.transactionPreviewStandaloneStyle.width}
                 onPreviewPressed={() => {
                     if (shouldShowSplitPreview) {
-                        Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.getRoute(action.reportActionID)));
+                        const basePath = isOnSearch && reportID ? getReportRouteForCurrentContext({reportID}) : undefined;
+                        Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.getRoute(action.reportActionID), basePath));
                         return;
                     }
 

Why this works across all entry points:

  • From a Search list row (isOnSearch === true): getReportRouteForCurrentContext({reportID}) produces search/view/<reportID>?backTo=<encodedSearchRoute>, and createDynamicRoute combines them into search/view/<reportID>/split/<reportActionID>?backTo=<encodedSearchRoute>. SCREENS.RIGHT_MODAL.SEARCH_REPORT passes entryScreens validation, supplies reportID to DynamicSplitBillDetailsPage, and preserves the active Search filters in backTo.
  • From inside an already-open SEARCH_REPORT RHP, EXPENSE_REPORT RHP, or standard REPORT (isOnSearch === false): basePath is undefined, so createDynamicRoute appends /split/<reportActionID> directly to the active route without overwriting the RHP's existing backTo parameter or adding unnecessary ?backTo params to standard chat URLs.

Regression coverage to add in tests/ui/ChatTransactionPreviewTest.tsx:

  • Render a split preview inside SearchScopeProvider, with Search as the topmost fullscreen route and an active filtered Search URL. Press it and assert a search/view/<reportID>/split/<reportActionID> destination whose decoded backTo equals the original Search URL.
  • Render outside the Search scope with an already-open SEARCH_REPORT above Search. Assert the existing base path and decoded backTo are retained, rather than nesting the current report URL in backTo.
  • Repeat outside the Search scope for REPORT, EXPENSE_REPORT, and SEARCH_MONEY_REQUEST_REPORT; preserve each active base path and its query parameters, cover a missing reportID, and leave the existing non-split test passing (SearchScopeProvider wraps only the Search list in src/components/Search/index.tsx:1486,1610 and defaults to isOnSearch: false outside a provider in src/components/Search/SearchScopeProvider.tsx:5-24).

What alternative solutions did you explore? (Optional)

  • Passing ROUTES.SEARCH_REPORT.getRoute({reportID}) without backTo: Loses the active Search query/filter state when navigating back or reloading, and if gated on isSearchTopmostFullScreenRoute(), strips the existing backTo parameter when pressing a split preview inside an already-open SEARCH_REPORT RHP.
  • Calling getReportRouteForCurrentContext({reportID}) unconditionally or gating on isSearchTopmostFullScreenRoute(): Unconditional calls add a redundant backTo to normal chat split URLs and break EXPENSE_REPORT RHP base paths; gating on isSearchTopmostFullScreenRoute() still runs when SEARCH_REPORT is already open in the RHP on top of Search, overwriting the original Search backTo with the current SEARCH_REPORT URL.

shilo1979jk avatar Oct 26 '26 14:10 shilo1979jk

@mkhutornyi this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Oct 29 '26 21:10 melvin-bot[bot]

@mkhutornyi Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Oct 29 '26 21:10 melvin-bot[bot]

Melvin's solution causes regression when refresh split bill detail page.

https://github.com/user-attachments/assets/cb4f81dc-e06b-4e06-affd-82522674dd95

mkhutornyi avatar Nov 01 '26 05:11 mkhutornyi

Proposal

What is the root cause of that problem?

Pressing a split preview builds a dynamic route with no base path:

https://github.com/Expensify/App/blob/1191e7b2fba721b609ec645880a4ce4456cda1ac/src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx#L76-L79

So createDynamicRoute appends split/<reportActionID> to the active route, which on Spend is search?q=... (https://github.com/Expensify/App/blob/1191e7b2fba721b609ec645880a4ce4456cda1ac/src/libs/Navigation/helpers/dynamicRoutesUtils/createDynamicRoute.ts#L83).

The Search root is not in SPLIT_BILL_DETAILS.entryScreens, so getStateFromPath rejects the match and falls back to Not Found:

https://github.com/Expensify/App/blob/1191e7b2fba721b609ec645880a4ce4456cda1ac/src/ROUTES.ts#L1862-L1866 https://github.com/Expensify/App/blob/1191e7b2fba721b609ec645880a4ce4456cda1ac/src/libs/Navigation/helpers/getStateFromPath.ts#L48

This came from #92052, which replaced the absolute r/:reportID/split/:reportActionID route with the dynamic one.

What changes do you think we should make in order to solve the problem?

Allow the split details route to open from the Search root, and pass the chat's reportID as a query param since the Search root has none. This is the same pattern REPORT_DETAILS already uses (https://github.com/Expensify/App/blob/1191e7b2fba721b609ec645880a4ce4456cda1ac/src/ROUTES.ts#L1706-L1718).

     SPLIT_BILL_DETAILS: {
         path: 'split/:reportActionID',
-        entryScreens: [SCREENS.REPORT, SCREENS.RIGHT_MODAL.SEARCH_REPORT, SCREENS.RIGHT_MODAL.EXPENSE_REPORT, SCREENS.RIGHT_MODAL.SEARCH_MONEY_REQUEST_REPORT],
-        getRoute: (reportActionID: string) => `split/${reportActionID}` as const,
+        entryScreens: [SCREENS.REPORT, SCREENS.RIGHT_MODAL.SEARCH_REPORT, SCREENS.RIGHT_MODAL.EXPENSE_REPORT, SCREENS.RIGHT_MODAL.SEARCH_MONEY_REQUEST_REPORT, SCREENS.SEARCH.ROOT],
+        getRoute: (reportActionID: string, reportID?: string) => getUrlWithParams(`split/${reportActionID}`, {reportID}),
+        queryParams: ['reportID'],
     },

In ChatTransactionPreview, pass reportID only when pressed from the Search list (useIsOnSearch()), so the report and RHP paths keep their current URLs:

+    const isOnSearch = useIsOnSearch();
 ...
-                        Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.getRoute(action.reportActionID)));
+                        Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.getRoute(action.reportActionID, isOnSearch ? reportID : undefined)));

The route becomes search/split/<reportActionID>?q=...&reportID=<chatReportID>. Back strips the suffix and the declared reportID (https://github.com/Expensify/App/blob/1191e7b2fba721b609ec645880a4ce4456cda1ac/src/hooks/useDynamicBackPath.ts#L36), so it returns to the filtered Search, also after a refresh.

What alternative solutions did you explore? (Optional)

Using ROUTES.SEARCH_REPORT (with or without backTo) as the base path. It opens the page, but Back is built from the URL minus the suffix, so after a refresh Back opens the 1:1 chat RHP instead of returning to Search. Without backTo the Search filters are also lost on refresh.

0xmiroslav avatar Nov 01 '26 05:11 0xmiroslav

Proposal

Please re-state the problem that we are trying to solve in this issue.

On Spend > Expenses with the Type filter set to Chat, clicking the split expense preview of a split created in a 1:1 chat opens a "Hmm... it's not here" page instead of the split details.

What is the root cause of that problem?

Chat-type search rows render the action with ReportActionItem, so a split action shows the regular split preview card. Pressing that card goes through ChatTransactionPreview, which builds the split details route with createDynamicRoute and no base path:

https://github.com/Expensify/App/blob/7e9ad84e6dede7bf27091b7f9accd1e85a997f2c/src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx#L70-L73

Without a base path, createDynamicRoute appends split/<reportActionID> to whatever route is active. Inside a report that is r/<reportID> or search/view/<reportID>, which works. On the Spend page the active route is the search route (search?q=...), so we navigate to search/split/<reportActionID>?q=....

The SPLIT_BILL_DETAILS dynamic route only allows report screens as entry screens, and the search root screen is not among them:

https://github.com/Expensify/App/blob/7e9ad84e6dede7bf27091b7f9accd1e85a997f2c/src/ROUTES.ts#L1745-L1749

So getStateFromPath rejects the suffix match. Even if the search screen were allowed, the search route has no reportID param, and the split details page loads its report from route.params.reportID. With no report it renders NotFoundPage:

https://github.com/Expensify/App/blob/7e9ad84e6dede7bf27091b7f9accd1e85a997f2c/src/pages/inbox/report/withReportAndReportActionOrNotFound.tsx#L99-L109

What changes do you think we should make in order to solve the problem?

In ChatTransactionPreview, pass an explicit base path to createDynamicRoute for the split details route instead of relying on the active route:

  • Use the existing getValidDynamicRouteBasePath helper with DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.entryScreens. Inside a report the active route is a valid entry screen and stays the base, so the chat and report flows are unchanged.
  • As the fallback path, use getReportRouteForCurrentContext({reportID}) (already imported in this file). On the Spend page it resolves to search/view/<chatReportID>, which is an allowed entry screen and carries reportID, so the split details page opens in the search RHP with the right chat report and split action.

https://github.com/Expensify/App/blob/7e9ad84e6dede7bf27091b7f9accd1e85a997f2c/src/libs/Navigation/helpers/getValidDynamicRouteBasePath.ts#L16-L35

The result: clicking the split preview from the Chat filter opens the split expense details, same as inside the chat.

Compare branch: https://github.com/Expensify/App/compare/main...wildan-m:App:wildan/104161-split-preview-search-route?expand=1

What alternative solutions did you explore? (Optional)

Add SCREENS.SEARCH.ROOT to the SPLIT_BILL_DETAILS entry screens. That alone does not work, because the search route carries no reportID, so the split details page still cannot find the report and shows not found.

wildan-m avatar Nov 01 '26 05:11 wildan-m

Proposal

Please re-state the problem that we are trying to solve in this issue.

Clicking a split expense preview in Spend > Type: Chat results opens "Hmm... it's not here" instead of the split details.

What is the root cause of that problem?

There are 2 problems in the split path here, and the second one only shows up once the first is fixed.

1. The route is built on top of the Search root. The split branch of the preview press handler builds the dynamic route without a base path

https://github.com/Expensify/App/blob/364fb3ddee4fc0533e3a7e108fbffb5115e0bd73/src/pages/inbox/report/actionContents/ChatTransactionPreview.tsx#L71-L74

so createDynamicRoute appends it to the active route and we get search/split/<reportActionID>?q=.... The Search root is not in SPLIT_BILL_DETAILS.entryScreens (and it has no reportID anyway), so getStateFromPath rejects the candidate and the path falls through to NotFound. The non split branches of the same handler already use getReportRouteForCurrentContext, only this one was left behind.

2. The split page can't load its own data on wide layout. Even with a valid base, a dynamic route only builds state for the dynamic screen itself, nothing for the base screen underneath

https://github.com/Expensify/App/blob/364fb3ddee4fc0533e3a7e108fbffb5115e0bd73/src/libs/Navigation/helpers/dynamicRoutesUtils/getStateForDynamicRoute.ts#L111-L112

From a report this is fine, because the chat is already open behind the RHP and its ReportScreen has called openReport. From Search nothing has opened that chat. Search rows are rendered from the snapshot, and its report actions are kept apart from the live reportActions_ collection (Search.ts). Now withReportAndReportActionOrNotFound reads the live collection and only fetches the report on narrow layout

https://github.com/Expensify/App/blob/364fb3ddee4fc0533e3a7e108fbffb5115e0bd73/src/pages/inbox/report/withReportAndReportActionOrNotFound.tsx#L79-L82

https://github.com/Expensify/App/blob/364fb3ddee4fc0533e3a7e108fbffb5115e0bd73/src/pages/inbox/report/withReportAndReportActionOrNotFound.tsx#L97-L103

So on web/desktop, for any chat whose actions aren't in Onyx yet (fresh sign in, cleared cache, an older chat the search dug up), reportActions stays empty, isLoadingReportAction stays true and the page spins forever. The issue repro doesn't hit this only because the tester had just opened that chat in step 2. Fixing just the base path would trade NotFound for an infinite loader in that case.

What changes do you think we should make in order to solve the problem?

  1. In ChatTransactionPreview, give the split route a real base, same helper as the other branches. In Search this is search/view/<chatReportID> (an allowed entry screen that carries reportID), in a report it stays r/<reportID>:
if (shouldShowSplitPreview) {
    const basePath = reportID ? getReportRouteForCurrentContext({reportID}) : undefined;
    Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.getRoute(action.reportActionID), basePath));
    return;
}
  1. In withReportAndReportActionOrNotFound, also fetch on wide layout when we have no actions at all for that report. When the chat is open underneath, actions are already there, so this never adds a second openReport in the normal flow:
useEffect(() => {
    if (!isEmptyObject(report) && !isEmptyObject(linkedReportAction)) {
        return;
    }
    if (!shouldUseNarrowLayout && hasReportActions) {
        return;
    }
    openReport({...});
}, [shouldUseNarrowLayout, props.route.params.reportID, currentUserAccountID]);

Tests:

  • getStateFromPath('search/view/1/split/2') resolves to the split details screen, and search/split/2 does not (this is the regression guard for 1).
  • Render the split details page on wide layout with the report in Onyx but no reportActions_<id>. Expect openReport to be called with that reportID and the page to render once the action arrives, instead of staying on the loader.

What alternative solutions did you explore? (Optional)

  • Pass ROUTES.SEARCH_REPORT.getRoute({reportID, reportActionID: action.reportActionID, backTo}) as the base. Back from split details then lands on the chat anchored at the split action, which is the same place a click on the rest of the row takes you (Search/index.tsx).
  • Instead of touching the HOC, have the split details page fall back to the snapshot action when the live one is missing. I'd rather not, the page also calls completeSplitBill with that action, and that should run on live data.
  • Only adding SCREENS.SEARCH.ROOT to entryScreens doesn't work, the Search root has no reportID, so the HOC would still show NotFound.

David-2002065 avatar Nov 01 '26 05:11 David-2002065