Skip to content

Navigate to the clicked expense in a multi-expense report preview (v2) - #97308

Draft
wildan-m wants to merge 1 commit into
Expensify:mainfrom
wildan-m:wildan/91042-multi-expense-preview-per-item-nav-v2
Draft

Navigate to the clicked expense in a multi-expense report preview (v2)#97308
wildan-m wants to merge 1 commit into
Expensify:mainfrom
wildan-m:wildan/91042-multi-expense-preview-per-item-nav-v2

Conversation

@wildan-m

Copy link
Copy Markdown
Contributor

Explanation of Change

v2 of #92546, which was reverted in #97198 after five deploy blockers.

Tapping a card in the multi-expense Report Preview carousel opens that expense instead of the parent report.

  • Wide layouts — unchanged from v1: the report opens in the super-wide RHP and the pressed expense cascades on top (180ms stagger).
  • Narrow layoutschanged: the expense now opens with a single plain forward navigation, so back returns to the chat.

What caused the blockers, and what v2 does about it

v1 inserted the parent report beneath the expense so that back stopped on the report first — a spliced stack entry on native (Navigation.openExpenseOverParentReport) and an extra history entry on mobile web. Every native blocker traced back to that hand-built stack being mutated by another flow:

blocker what went wrong
#97184 delete from details → goBack couldn't param-match the spliced parent (its backTo isn't in routeParamsIgnore) → REPLACE inserted a duplicate report route → back showed the report twice
#97183 split-expense save → removeScreenByKey only filters the root navigator, so the stale thread route nested in the split survived → back landed on the LHN
#97158 resolve duplicates → deleting the open thread while the spliced parent sat beneath it crashed on Android
#97149 an expense deleted while offline stays in the carousel but its thread is gone → "It's not here"

v2 removes the splice entirely. Navigation.ts is untouched by this PR — no custom stack manipulation, nothing for those flows to trip over. #97149 is additionally guarded explicitly: a pending-DELETE press opens the parent report.

The trade-off is one intermediate stop: on narrow, back goes expense → chat rather than expense → report → chat. Given #97155 also showed the intended wide cascade being read as a bug, I'd rather ship the simple stack and revisit the extra stop separately if it's wanted.

#97155 was closed with the revert and needs no code change here — it was the intended wide-layout cascade.

Fixed Issues

$ #91042
PROPOSAL: #91042 (comment)

Tests

  1. Open a workspace chat containing a report preview with two or more expenses.
  2. Tap one of the expense cards in the carousel.
  3. Verify the expense you tapped opens (not the parent report).
    • Wide: the report opens in the wide RHP with the pressed expense on top.
    • Narrow: the expense opens full-screen.
  4. Press back. Verify you return to the chat on narrow; on wide, back closes the expense to the report, then the chat.
  5. Repeat for a different card and verify it opens that card's expense.
  6. Open a report preview with exactly one expense, tap it, and verify the report opens.
  7. Verify the View button still opens the report.
  • Verify that no errors appear in the JS console

Offline tests

  1. Go offline.
  2. In a multi-expense report preview, delete one of the expenses.
  3. The deleted expense stays visible in the carousel — tap it.
  4. Verify the parent report opens and you do not land on "It's not here" ([Due for payment 2026-08-05] Report - Expense deleted offline can still be opened and leads to "It´s not here" RHP. #97149).

QA Steps

Same as Tests, plus the regression checks from the reverted PR's blockers:

  1. [Due for payment 2026-08-05] Android - Report -After deleting expense from details page, back button leads to report again #97184 — Android: tap an expense preview → header → details → delete the expense. Verify you land on the parent report and one back reaches the chat.
  2. [Due for payment 2026-08-05] Android - Expense - Back button returns to LHN after splitting expense #97183 — Android: tap an expense preview → More > Split > Save, then hardware back. Verify you return to the workspace chat, not the LHN.
  3. [Due for payment 2026-08-05] Android - Report - App crashes after keeping one duplicate expense. #97158 — Android: workspace chat with two similar expenses → tap the second preview → Review Duplicates → select the other expense → Keep Selected → Confirm. Verify no crash.
  • Verify that no errors appear in the JS console

Tapping a card in the multi-expense report preview carousel opens that expense instead of the parent report. Wide layouts keep the report in the super-wide RHP and cascade the pressed expense on top; narrow layouts open the expense with a single forward navigation, so back returns to the chat.

This is v2 of Expensify#92546, which was reverted for five deploy blockers. v1 inserted the parent report beneath the expense so back stopped on the report first -- a spliced stack entry on native, an extra history entry on mobile web. That hand-built stack is gone: it broke whenever another flow mutated it (Expensify#97184 replaced the deleted thread with a duplicate report route, Expensify#97183 left a stale route after a split save, Expensify#97158 crashed resolving duplicates) and on mobile web the extra entry forced a state rebuild that flashed the chat on back. Navigation.ts is untouched by this version.

Also guards an expense deleted while offline (Expensify#97149): those rows stay in the carousel but their thread is gone, so pressing one now opens the parent report instead of landing on 'It's not here'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant