Skip to content

refactor: the new-transaction highlight rail and the wide RHP width model - #98744

Merged
blimpich merged 55 commits into
Expensify:mainfrom
TaduJR:refactor-Reports-newTransactionHighlight-and-RHPLayout-followups
Sep 9, 2026
Merged

blimpich merged 55 commits into
Expensify:mainfrom
TaduJR:refactor-Reports-newTransactionHighlight-and-RHPLayout-followups

Conversation

@TaduJR

@TaduJR TaduJR commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Follow-up to #89585, which shipped the duplicate-expense highlight. The behaviour is the same duplicating an expense still highlights the new row and widens the panel but the code behind it is simpler and a few rough edges are fixed.

Marking a new expense. Each mark now records when it was written, so clearing an old mark can't wipe a newer one for the same expense. And only one place decides whether to write a mark, instead of two that could disagree about it.

The wide panel. Which screens show wide is now worked out from the navigation state as it renders, instead of being kept in a second copy that had to be updated by hand. That removes the two functions doing the syncing, plus an API nothing read. A panel that's closing also keeps its width until the animation finishes, rather than snapping narrow straight away.

The animation. The row appears as soon as it's added, and only the flash waits until the screen is in front so an expense added while you're looking at something else is still highlighted when you come back. A highlight now also survives the list re-sorting underneath it.

One thing worth knowing when reviewing: the stored shape of pendingNewTransactionIDs changed. Marks written by the current production build are ignored rather than read. Nothing needs migrating old entries are cleaned up the first time they're read.

Fixed Issues

$ #96327
PROPOSAL:

Tests

Read first

  • Tests 4–7 need web or desktop in a maximised window. The wide side panel does not exist on mobile or in a narrow window — skip them there.
  • The highlight appears in two places: the expense cards inside a chat, and the rows of the expense report table. Some steps below name which one.
  • "The row highlights" means two things in order: it fades and grows into place, then its background briefly changes colour and fades back. Watch for both.
  • Duplicating is used throughout: click the expense row → MoreDuplicate expense. Right-clicking a row does nothing.

Setup

  • Report A**: an expense report on a workspace with 2 or more expenses.
  • Report B: one with exactly 1 expense.
  • Report C: an empty expense report.
  • The workspace matters — on a personal report a duplicate may move to a new report, and no highlight is expected.

⚠️ A known unrelated bug
Re-opening a chat you already visited this session can make existing expenses flash in that chat's expense cards. That is #98308, already live in production, neither caused nor fixed here. Please don't file it against this PR, but do mention it if you see it — it can be mistaken for a failure of test 2.


1. New expenses are highlighted, and stay highlighted

  1. Open report A.
  2. Click an expense row, click More, then Duplicate expense.
  3. Verify a copy appears in the list, and that it fades in then flashes once.
  4. Verify no other row flashes.
  5. Verify that if the copy shifts position on its own moments later, the highlight continues rather than cutting out.
  6. Wait about 3 seconds, then duplicate a different expense.
  7. Verify the second copy also flashes.
  8. While it is still flashing, click a column header (Date, Merchant, Category or Amount) to re-sort.
  9. Verify the row keeps its highlight through the re-sort.
  10. Delete one expense (row → MoreDelete), then duplicate another.
  11. Verify the newly added one flashes.

2. Nothing flashes when it shouldn't

  1. Open report C (the empty one) and add a single expense.
  2. Verify it appears and does not flash.
  3. Open report A, click an expense already on it, change its amount or description, and save.
  4. Return to the list and verify that row shows the new value and does not flash.
  5. From report A, switch directly to report B.
  6. Verify no row on report B flashes, including right after the switch while the list is still filling in.
  7. Switch back and forth several times quickly and verify nothing flashes on either.

3. Bulk duplicate

  1. Open report A.
  2. Tick the checkbox on two or more rows.
  3. Verify a button appears showing the count, e.g. "2 selected", and click it.
  4. Click Duplicate expense.
  5. Verify a copy appears for each selected expense.
  6. Verify every copy is highlighted, not just the first.

4. The panel width follows the report (web/desktop, maximised)

  1. Click the Spend tab, then Expenses. (Not the "Search" button inside a chat — different feature.)
  2. Verify results are grouped into expense reports; if not, use the grouping control and choose Expense reports.
  3. Click a report with more than one expense.
  4. Verify the panel opens at its widest immediately, without opening narrow and jumping wider.
  5. With it still open, delete expenses one at a time until one remains.
  6. Verify the panel shrinks to medium width without being closed and reopened.
  7. Go back and open a report with exactly one expense.
  8. Verify it opens at medium width.

5. The panel keeps its width while closing (web/desktop, maximised)

  1. From Spend → Expenses, open a report with several expenses (widest).
  2. Close it with the back button and watch the very first moment of the animation.
  3. Verify it slides out at full width and does not snap narrow first.
  4. Reopen it, close with the Escape key, and verify the same.
  5. Reopen it, then click one expense so a second screen stacks on top.
  6. Close only that second screen.
  7. Verify the report panel behind stays at full width throughout and does not flicker narrower.

6. A stacked panel stays visible and clickable (web/desktop, maximised)

  1. From Spend → Expenses, open a report with several expenses.
  2. Click one expense so a second screen stacks on top.
  3. Verify the report behind is still visible and dimmed to the left.
  4. From the top screen, click More then Duplicate expense.
  5. Verify the new row flashes in the dimmed report behind you, while you are still on the top screen.
  6. Click the dimmed area and verify it returns you to the report.

7. The panel survives navigation (web/desktop, maximised)

  1. From Spend → Expenses, open a report with several expenses.
  2. Without closing it, switch to another tab (Inbox or Workspaces).
  3. Verify that tab lays out normally, with no leftover wide panel and no stray dimmed area.
  4. Return to Spend and verify the panel comes back at its proper width.
  5. Open a single expense in the panel and click the next arrow.
  6. Step through several expenses using next and previous.
  7. Verify each opens at a sensible width with no flicker, and the position counter stays in step.

8. On mobile the highlight waits for you (iOS, Android, or a narrow browser window)

  1. Open report A.
  2. Click one expense so it fully covers the report.
  3. Click More then Duplicate expense.
  4. Verify no flash is visible while the report is covered.
  5. Go back to the report.
  6. Verify the new row is fully visible — correct height, not blank or collapsed — and flashes on arrival.
  7. Repeat, but stay on the covering screen for two minutes first. Verify it is still fully visible and still flashes.

Offline tests

Same as tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."
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
    • MacOS: Desktop
  • 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 verified there are no new alerts related to the canBeMissing param for useOnyx
  • 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
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • 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
Android-Native.mp4
Android: mWeb Chrome
iOS: Native
iOS-Native.mp4
iOS: mWeb Safari
iOS-Safari.mp4
MacOS: Chrome / Safari
Mac-Chrome.mp4

TaduJR added 20 commits July 15, 2026 23:15
…ports-newTransactionHighlight-and-RHPLayout-followups

# Conflicts:
#	src/selectors/ReportMetaData.ts
…ports-newTransactionHighlight-and-RHPLayout-followups
…ports-newTransactionHighlight-and-RHPLayout-followups
…ports-newTransactionHighlight-and-RHPLayout-followups
…ports-newTransactionHighlight-and-RHPLayout-followups
…ports-newTransactionHighlight-and-RHPLayout-followups

# Conflicts:
#	src/selectors/ReportMetaData.ts
…ports-newTransactionHighlight-and-RHPLayout-followups

# Conflicts:
#	src/components/Search/index.tsx
#	src/libs/actions/IOU/MoneyRequestBuilder.ts
#	src/pages/iou/request/step/confirmation/useExpenseSubmission.ts
#	tests/actions/IOU/GetMoneyRequestInformationTest.ts
@TaduJR
TaduJR requested review from a team as code owners August 17, 2026 05:59
@melvin-bot
melvin-bot Bot requested a review from abzokhattab August 17, 2026 05:59
@melvin-bot

melvin-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

@abzokhattab 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]

@melvin-bot
melvin-bot Bot requested review from garrettmknight and removed request for a team August 17, 2026 05:59
@TaduJR
TaduJR marked this pull request as draft August 17, 2026 06:00
@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/CONST/index.ts 91.22% <ø> (ø)
...equestReportView/MoneyRequestReportActionsList.tsx 60.44% <100.00%> (ø)
...portActionItem/MoneyRequestReportPreview/index.tsx 95.12% <100.00%> (ø)
...onents/ScreenWrapper/ScreenWrapperStatusContext.ts 100.00% <ø> (ø)
src/components/ScreenWrapper/index.tsx 92.68% <100.00%> (ø)
...archList/ListItem/TransactionGroupListExpanded.tsx 68.18% <ø> (ø)
src/components/WideRHPContextProvider/default.ts 42.85% <ø> (+15.58%) ⬆️
...s/WideRHPContextProvider/getIsRHPDisplayedBelow.ts 100.00% <100.00%> (+100.00%) ⬆️
...s/WideRHPContextProvider/getVisibleRHPRouteKeys.ts 100.00% <100.00%> (+100.00%) ⬆️
...onents/WideRHPContextProvider/useRHPWidth/index.ts 96.15% <100.00%> (+96.15%) ⬆️
... and 16 more
... and 9 files with indirect coverage changes

@OSBotify

OSBotify commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/blimpich in version: 9.4.75-0 🚀

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

@MelvinBot

MelvinBot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🤖 No help site changes are required for this PR, so I did not create a draft docs PR.

This is a refactor with no user-facing change. Nothing in App/docs/articles describes the behavior it touches.

Why

No copy changed. No src/languages/* file is in the diff. The only non-test, non-component addition is an internal timing constant, src/CONST/index.ts:322 (PENDING_TRANSACTION_FRESHNESS_WINDOW). No new feature, setting, tab, or button.

Nothing documented changed. The PR reworks three things, all of which the help site is silent on:

  • The new-expense highlight — the fade-in and flash on a newly added row. No article mentions this animation. The nearest one, docs/articles/new-expensify/reports-and-expenses/How-to-Duplicate-an-Expense.md, documents where to click and what gets copied — not how the row animates.
  • The wide side panel width model — internal navigation-state plumbing. Panel widths and transition timing are not documented anywhere in the help site.
  • The stored shape of pendingNewTransactionIDs — internal Onyx data, invisible to members and self-cleaning.

The duplicate flow itself is unchanged, so the existing steps in How-to-Duplicate-an-Expense.md stay accurate.


One pre-existing inaccuracy I noticed, unrelated to this PR. I checked the labels in the live UI on web. How-to-Duplicate-an-Expense.md tells members to click Selected in the bulk flow, but the button actually reads 2 selected — it carries the count. Everything else in that article matched: the tab is Spend > Expenses, the bulk menu option is Duplicate expenses (plural), and the single-expense More menu option is Duplicate expense (singular).

That predates this PR and is out of scope here. Reply with @MelvinBot fix the Selected label in How-to-Duplicate-an-Expense.md if you want a draft PR for it.

@TaduJR — since no docs changes are needed, there is no linked help site PR to review or mark Ready for review. If you think a behavior change here is member-visible and should be documented, tell me which part and I'll draft it.


view run · no recording available

@nlemma

nlemma commented Sep 9, 2026

Copy link
Copy Markdown

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

@lanitochka17

Copy link
Copy Markdown

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

@nlemma

nlemma commented Sep 9, 2026

Copy link
Copy Markdown

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

@nlemma

nlemma commented Sep 9, 2026

Copy link
Copy Markdown

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

@lanitochka17

Copy link
Copy Markdown

Deploy Blocker #100771 was identified to be related to this PR

@jponikarchuk

Copy link
Copy Markdown

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

@jponikarchuk

jponikarchuk commented Sep 10, 2026

Copy link
Copy Markdown

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

@mitarachim

Copy link
Copy Markdown

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/mountiny in version: 9.4.75-3 🚀

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

Bundle Size Analysis (Sentry):

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/mountiny in version: 9.4.75-3 🚀

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

Bundle Size Analysis (Sentry):

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.

9 participants