Skip to content

Navigate to the clicked expense in a multi-expense report preview - #92546

Merged
MonilBhavsar merged 56 commits into
Expensify:mainfrom
wildan-m:wildan/91042-multi-expense-preview-per-item-nav
Jul 27, 2026
Merged

MonilBhavsar merged 56 commits into
Expensify:mainfrom
wildan-m:wildan/91042-multi-expense-preview-per-item-nav

Conversation

@wildan-m

@wildan-m wildan-m commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

In a multi-expense report preview — the carousel shown in chat when a report has more than one expense — clicking any expense card opens the parent report instead of the expense that was clicked. Every card is wired to the same report-level press handler, so the specific expense a user taps is ignored even though it is already known when each card is built.

Each card now opens its own expense instead. On wide layouts the expense opens in the right-hand pane; on narrow layouts the report is pushed first and the expense on top of it, so going back returns to the report rather than straight to the chat. If a card's expense thread hasn't been created yet it is created on the fly so the tap never lands on a dead route, falling back to the parent report only when neither is possible. A grey "View" button is now always present in the preview's action row so the parent report stays reachable alongside whatever primary action (Submit, Approve, Pay, and so on) the report currently shows.

Fixed Issues

$ #91042
PROPOSAL: #91042 (comment)

Tests

  1. Open a workspace chat that contains an expense report with more than one expense, shown in chat as the multi-expense report preview. (To set one up: create a workspace and submit two expenses to it so they group into a single report.)
  2. Confirm the preview shows a horizontal carousel with one card per expense, and that a grey "View" button is shown next to the primary action button (e.g. Submit).
  3. Click the first expense card. Verify it opens that specific expense (its merchant and amount match the card), not the parent report.
  4. Go back to the chat and click a different expense card. Verify it opens that other expense (different merchant/amount) — i.e. each card opens its own expense.
  5. On a narrow layout (mobile/mWeb), click an expense card and verify it opens that expense; press back once and verify you land on the report, not directly on the chat.
  6. Click the grey "View" button in the preview and verify it opens the parent report.
  7. Verify that no errors appear in the JS console.

Offline tests

Same as Tests, performed with the network connection turned off. Opening an expense whose thread already exists is pure navigation and works offline. Opening one whose thread has not been created yet reuses the existing optimistic thread-creation flow (the same one used when opening a standalone expense in chat), so it also works offline.

QA Steps

Same as Tests.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Kapture.2026-06-07.at.13.51.00.mp4
Android: mWeb Chrome
Kapture.2026-06-07.at.13.53.22.mp4
iOS: Native
Kapture.2026-06-07.at.13.35.26.mp4
iOS: mWeb Safari
Kapture.2026-06-07.at.13.44.08.mp4
MacOS: Chrome / Safari
Kapture.2026-06-07.at.09.01.47.mp4

@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
...RequestReportPreview/ReportPreviewActionButton.tsx 100.00% <100.00%> (ø)
...portActionItem/MoneyRequestReportPreview/index.tsx 92.98% <90.47%> (+0.67%) ⬆️
src/libs/Navigation/Navigation.ts 45.61% <0.00%> (-1.91%) ⬇️
... and 15 files with indirect coverage changes

@wildan-m
wildan-m marked this pull request as ready for review June 7, 2026 06:58
@wildan-m
wildan-m requested review from a team as code owners June 7, 2026 06:58
@melvin-bot
melvin-bot Bot requested review from heyjennahay and jayeshmangwani and removed request for a team June 7, 2026 06:58
@melvin-bot

melvin-bot Bot commented Jun 7, 2026

Copy link
Copy Markdown

@jayeshmangwani Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

🚧 @shawnborton has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

This comment has been minimized.

@shawnborton

Copy link
Copy Markdown
Contributor

Hmm I thought we wanted to open up the expense with the report below it? cc @mountiny

Right now it seems like we only open up the expense in the RHP, and not the report with the expense open.

@shawnborton

Copy link
Copy Markdown
Contributor

For single expense reports like this, we should just still continue to open up the report view:
CleanShot 2026-06-08 at 10 40 26@2x

Otherwise you get this odd behavior:

CleanShot.2026-06-08.at.10.40.55.mp4

@mountiny

mountiny commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Yep that was the idea to open both the multiexpense and over that the report detail so basically push both

@jayeshmangwani

Copy link
Copy Markdown
Contributor

@wildan-m , we can see both buttons here. If there's only a single report, I don't think we should display the View button.
Screenshot 2026-06-08 at 5 03 42 PM


when a single expense report is pressed, can we keep the current behavior and open EXPENSE_REPORT_RHP instead of navigating to SEARCH_ROOT?

staging-behavior-ve-PR-behavior.mov

@shawnborton

Copy link
Copy Markdown
Contributor

we can see both buttons here. If there's only a single report, I don't think we should display the View button.

I think it's probably fine to show both buttons in that case - I thought we basically always wanted to show both buttons, so that all cases had at least a View button as well? cc @Expensify/design

@dannymcclain

Copy link
Copy Markdown
Contributor

I think it's probably fine to show both buttons in that case - I thought we basically always wanted to show both buttons, so that all cases had at least a View button as well? cc @Expensify/design

Agree!

@dubielzyk-expensify

Copy link
Copy Markdown
Contributor

Yeah same. I agree with that. Looks fine to me 👍

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@dubielzyk-expensify

Copy link
Copy Markdown
Contributor

Yeah I definitely think they should be almost the same but with a slight stagger of animation. The video seems too slow and unintentional atm. What's the current delay from sheet 1 to 2 in milliseconds?

@MonilBhavsar

Copy link
Copy Markdown
Contributor

Yeah I definitely think they should be almost the same but with a slight stagger of animation.

Agree 👍

We have cascading delay of 180ms
But I think this is the result of Onyx write + delay.
https://github.com/Expensify/App/pull/92546/changes#diff-a33f374a8b265f2c4414adad61ad9a96824c6f5246e4ae72acd8629b98b8800bR256-R267

@wildan-m @jayeshmangwani could anyone please take a look and make a followup PR? Other animations in the App and their timings are defined here, which should give the idea

ANIMATION_TIMING: {

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/MonilBhavsar in version: 9.4.45-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 I reviewed the changes in this PR and yes, a help site update is warranted.

This PR changes user-facing behavior in the multi-expense Report Previews carousel:

  • Clicking an individual expense card now opens that specific expense (previously it opened the parent report).
  • A grey View button is now always shown in the preview's action row (alongside the role-based action button like Submit, Approve, or Pay) so the full report stays reachable.

The Getting Started with the Spend Page article documents the Report Previews carousel but predates both of these behaviors, so I drafted an update to it.

Draft help site PR: #97142

  • Updated the action-button line to note both the role-based action button and the always-present View button.
  • Added a How to open an expense or the report from a report preview section describing per-expense navigation (wide vs. narrow layout) and the View button.

Labeled HelpDot. Note: I couldn't set wildan-m as an assignee — GitHub reports the account isn't assignable on Expensify/App (typical for external contributors), so I've @-mentioned you in the draft PR body instead.

@wildan-m, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR Ready for review

@jponikarchuk

Copy link
Copy Markdown

Deploy Blocker #97149 was identified to be related to this PR.

@lanitochka17

Copy link
Copy Markdown

Deploy Blocker ##97155 was identified to be related to this PR.

@jponikarchuk

Copy link
Copy Markdown

Deploy Blocker #97183 was identified to be related to this PR.

@mitarachim

Copy link
Copy Markdown

Deploy Blocker #97184 was identified to be related to this PR.

MonilBhavsar added a commit that referenced this pull request Jul 28, 2026
[CP staging] Revert "Navigate to the clicked expense in a multi-expense report preview- #92546"
askavyblr pushed a commit to askavyblr/App that referenced this pull request Jul 28, 2026
…-multi-expense-preview-per-item-nav"

This reverts commit fd93ec9, reversing
changes made to 8a12457.
OSBotify pushed a commit that referenced this pull request Jul 28, 2026
[CP staging] Revert "Navigate to the clicked expense in a multi-expense report preview- #92546"

(cherry picked from commit fae30fa)

(cherry-picked to staging by roryabraham)
@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/marcaaron in version: 9.4.45-14 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/MonilBhavsar in version: 9.4.46-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 No help site changes required.

I reviewed the changes in this PR against Expensify's help site articles under docs/articles and confirmed no updates are needed.

Why

This PR is a bug fix / minor interaction change for the multi-expense report preview carousel shown in chat:

  • Clicking an expense card now opens that specific expense (previously it opened the parent report).
  • A grey View button is now always shown in the preview's action row so the parent report stays reachable.

The help site documents how to accomplish tasks (creating expenses/reports, approving, paying, managing expenses in a report, etc.), not the interaction-level detail of tapping a card in an in-chat report preview. I searched docs/articles/new-expensify for the report preview carousel, expense-card click behavior, and the "View" button and found no article that describes this UI or the navigation behavior being changed. Since the behavior isn't documented, there's nothing to correct — the change makes the interaction match what users already expect.

@wildan-m — no linked help site PR was created since no documentation changes are required. If you believe a specific article should describe this behavior, point me at it and I'll draft an update.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/marcaaron in version: 9.4.46-10 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

MonilBhavsar pushed a commit that referenced this pull request Sep 7, 2026
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 #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 (#97184 replaced the deleted thread with a duplicate report route, #97183 left a stale route after a split save, #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 (#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.