Skip to content

[CP Staging] revert: refactor the new-transaction highlight rail and the wide RHP width model - #100810

Merged
mountiny merged 2 commits into
Expensify:mainfrom
TaduJR:revert-refactor-Reports-newTransactionHighlight-and-RHPLayout-followups
Sep 10, 2026
Merged

mountiny merged 2 commits into
Expensify:mainfrom
TaduJR:revert-refactor-Reports-newTransactionHighlight-and-RHPLayout-followups

Conversation

@TaduJR

@TaduJR TaduJR commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Straight revert of #98744

Fixed Issues

$ #100757
$ #100761
$ #100763
$ #100770
$ #100771
$ #100782
$ #100787
$ #100789
PROPOSAL:

Tests

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • 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: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

@TaduJR
TaduJR requested review from a team as code owners September 10, 2026 10:02
@melvin-bot
melvin-bot Bot requested review from Pujan92, ZhenjaHorbach, abzokhattab and joekaufmanexpensify and removed request for a team September 10, 2026 10:02
@melvin-bot

melvin-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

@abzokhattab @Pujan92 @ZhenjaHorbach One of you needs to 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]

@ZhenjaHorbach

Copy link
Copy Markdown
Contributor

@abzokhattab
I suppose it's yours? 😁

@codecov

codecov Bot commented Sep 10, 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.80% <100.00%> (ø)
...onents/ScreenWrapper/ScreenWrapperStatusContext.ts 100.00% <ø> (ø)
src/components/ScreenWrapper/index.tsx 92.68% <100.00%> (ø)
...archList/ListItem/TransactionGroupListExpanded.tsx 68.18% <ø> (ø)
...hooks/useResponsiveLayoutOnWideRHP/index.native.ts 100.00% <ø> (ø)
src/hooks/useScreenWrapperTransitionStatus.ts 75.00% <100.00%> (ø)
src/libs/actions/IOU/Split.ts 77.13% <100.00%> (+0.09%) ⬆️
src/selectors/ReportMetaData.ts 100.00% <100.00%> (+1.78%) ⬆️
... and 14 more
... and 15 files with indirect coverage changes

@TaduJR TaduJR changed the title revert: refactor-Reports-newTransactionHighlight-and-RHPLayout-followups revert: refactor the new-transaction highlight rail and the wide RHP width model Sep 10, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fcf5119727

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +123 to +124
// The table is visible whenever it's wide, or — on narrow — only when focused (the RHP has closed).
const isReportVisible = shouldUseNarrowLayout ? isFocused : true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat background report tabs as covered

On a wide layout this unconditionally considers the report visible, even after the user switches to another full-screen tab while the report remains mounted. If a transaction arrives in that state, its one-shot highlight runs off-screen and will not replay when the user returns because shouldHighlight remained true throughout. Visibility on wide layouts still needs to verify that this report belongs to the active tab, while allowing an RHP beside that same tab.

Useful? React with 👍 / 👎.

lastPendingNewTransactions.set(pendingNewTransactionIDs, classified);
return classified;
};
const pendingNewTransactionIDsSelector = (reportMetadata: OnyxEntry<ReportMetadata>) => reportMetadata?.pendingNewTransactionIDs;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Expire abandoned transaction highlight flags

This selector now returns every truthy pending ID indefinitely, with no timestamp or freshness check. If the app is terminated before the delayed deletion runs—for example, within four seconds of submitting an expense—the persisted flag survives, and reopening the report later treats the old transaction as newly added and replays its highlight. These flags need a bounded lifetime so an interrupted cleanup cannot leave stale highlights permanently.

Useful? React with 👍 / 👎.

Comment on lines +696 to +700
const existingReportTransactions = iou.report?.reportID
? getReportTransactions(iou.report.reportID).filter((reportTransaction) => reportTransaction.transactionID !== transaction.transactionID)
: [];
const addMakesReportMultiTransaction =
isMoneyRequestReport(iou.report) && existingReportTransactions.some((reportTransaction) => reportTransaction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use the report count when the transaction cache is partial

When only part of an existing report is cached, this predicate can return false even though adding the transaction makes the report multi-transaction—for example, a report with transactionCount greater than one whose only cached transaction is pending deletion. The pending highlight flag is then omitted, and because the 1→2 transition fresh-mounts the table with the new transaction already present, diff-based detection also skips it. Fall back to the report's transaction count unless the cache is complete enough to account for pending deletions.

Useful? React with 👍 / 👎.

@TaduJR
TaduJR marked this pull request as draft September 10, 2026 10:25
@TaduJR

TaduJR commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor Author

The react-compiler-compliance-check failure here is expected and needs a waiver.

It fails on one file, src/hooks/useNewTransactions.ts. That file did not compile with React Compiler before #98744 either, so it was grandfathered. #98744 is what made it compile. This PR restores the old code, and the check reads that as a regression because the file compiles on main today.

I can't fix it inside a revert. The useMemo in that file deliberately leaves prevTransactions out of its dependency list, and that omission is load-bearing: usePrevious catches up in an effect, so with a complete dependency list the diff recomputes to empty on the next render and the highlight disappears. React Compiler works out dependencies from the code, so that memo can't be expressed. Making the file compile means replacing it with state, which is exactly the change this PR is reverting.

Two things I checked before asking: the check has no baseline or ignore list like the eslint seatbelt does, and 'use no memo' doesn't help. It satisfies the OXC compiler, but Babel still fails, and the check requires both.

What should we do here @abzokhattab? I am also thinking to roll-forward all the related issues since they are minor highlight issues.

@mountiny mountiny changed the title revert: refactor the new-transaction highlight rail and the wide RHP width model [CP Staging] revert: refactor the new-transaction highlight rail and the wide RHP width model Sep 10, 2026
@TaduJR
TaduJR marked this pull request as ready for review September 10, 2026 10:57

@mountiny mountiny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Straight revert

@mountiny
mountiny merged commit 4e30038 into Expensify:main Sep 10, 2026
36 of 39 checks passed
@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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78b07d9890

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

} else if (!hasReplacedBaseline && !isHydratingFromEmpty) {
addedIDs = trackedTransactionIDs.filter((transactionID) => !baselineIDs.has(transactionID));
// If we haven't loaded report yet we set previous transaction ids to undefined.
const prevTransactions = usePrevious(hasOnceLoadedReportActions ? transactions : undefined);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reset the transaction baseline when the report changes

When the mounted report screen changes reportID during next/previous navigation, this baseline still contains the prior report's transactions. If the incoming report has more rows, the length check treats every ID absent from the prior report as newly added, causing existing expenses to scroll into view and animate as new. Key or reset the baseline whenever reportID changes.

Useful? React with 👍 / 👎.

return;
}

markReportRHPWidth(reportID, 'wide');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Defer the RHP width hint until after the new-tab guard

On web, a Ctrl/Cmd-click returns from openInternalRouteInNewTab() without navigating the current tab, but this call has already stored a width hint that no screen mounts to consume or clear. A later in-tab visit to the same report can therefore inherit the stale width—even after the report no longer qualifies for it—and useRHPWidth keeps a higher hint when the calculated width is narrower. Set the hint only after the new-tab early return.

Useful? React with 👍 / 👎.

OSBotify pushed a commit that referenced this pull request Sep 10, 2026
…nsactionHighlight-and-RHPLayout-followups

[CP Staging] revert: refactor the new-transaction highlight rail and the wide RHP width model

(cherry picked from commit 4e30038)

(cherry-picked to staging by mountiny)
@OSBotify OSBotify added the CP Staging marks PRs that have been CP'd to staging label Sep 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.4.75-1 🚀

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

@MelvinBot

MelvinBot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

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

Why: This is a straight revert of #98744, which was itself an internal refactor that explicitly preserved behavior ("The behaviour is the same — duplicating an expense still highlights the new row and widens the panel, but the code behind it is simpler"). Reverting it restores the same user-visible behavior that shipped with #89585.

What I checked

The diff is entirely internal. All 50 changed files are hooks, selectors, navigation/layout internals, and tests:

  • src/components/WideRHPContextProvider/* — right-hand panel width model
  • src/hooks/useAnimatedHighlightStyle, useNewTransactions, useIsReportVisible, useResponsiveLayoutOnWideRHP
  • src/libs/actions/IOU/PendingNewTransactions.ts, PendingNewTransactionFlags.ts
  • tests/**

No user-facing copy changed. No files under src/languages/ are touched, so no strings, labels, buttons, or menu names changed.

No existing article documents this behavior. I searched docs/articles for the affected concepts (row highlighting, panel width, duplicate-expense highlight). The relevant articles — How-to-Duplicate-an-Expense.md and Expense-and-Report-Actions.md — contain no description of row highlighting or panel widths, so nothing goes stale.

Only internal-facing state changed shape. The stored shape of pendingNewTransactionIDs reverts, but that is Onyx state, not something the help site describes.

Because there is no documented behavior to update, writing an article here would add content the help site does not currently cover, which the authoring guidelines discourage.

If you believe a user-visible difference does exist between the reverted state and #98744, tell me what it is and I'll draft the docs PR.


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


view run · view recording

@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

🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.4.76-0 🚀

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

@MelvinBot

MelvinBot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

No help site changes are required. I did not create a docs PR.

This PR is a straight revert of #98744, and both PRs are pure internal refactors. Nothing user-facing changed, so nothing under App/docs/articles is affected.

What I checked

The diff touches only internal code and tests — 50 files across:

  • Layout/navigation internals: src/components/WideRHPContextProvider/*, src/hooks/useResponsiveLayoutOnWideRHP/*, src/components/ScreenWrapper/*, src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx
  • New-transaction highlight internals: src/hooks/useAnimatedHighlightStyle/index.ts, src/hooks/useNewTransactions.ts, src/libs/PendingNewTransactionFlags.ts, src/libs/actions/IOU/PendingNewTransactions.ts, src/selectors/ReportMetaData.ts
  • Test files (20 of the 50 changed files)

No user-facing copy changed. Zero files under src/languages/ are in the diff, and no translate() strings were added, removed, or reworded. The only CONST changes are internal timing/flag constants (PENDING_TRANSACTION_DELETION_DELAY, PENDING_TRANSACTION_FRESHNESS_WINDOW) and layout booleans — none of which appear in the UI.

No docs were touched by the original PR either. #98744 changed the same 50 files, none under docs/.

No affected help articles. I searched App/docs/articles for content describing the row highlight and the right-hand side panel. The "highlight" matches are all unrelated integration sync/export error articles. The "side panel" matches (for example, new-expensify/reports-and-expenses/Edit-Expenses.md) describe that a side panel opens and what you do in it — this revert changes only how the panel's width is computed internally, so those articles stay accurate either way.

Feature names and labels: since no article text needs to change, there was nothing to verify against the live UI. HELPSITE_NAMING_CONVENTIONS.md, HELP_AUTHORING_GUIDELINES.md, and TEMPLATE.md apply to new or edited articles, and no article qualifies here.

@TaduJR, since no docs PR was created, there is no help site PR to review or mark Ready for review. If you believe the revert does change something a customer would see in the UI, reply with @MelvinBot and the specific behavior, and I will draft the docs PR.


view run · no recording available

@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.76-1 🚀

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

Bundle Size Analysis (Sentry):

@TaduJR
TaduJR deleted the revert-refactor-Reports-newTransactionHighlight-and-RHPLayout-followups branch September 23, 2026 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CP Staging marks PRs that have been CP'd to staging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants