Repository navigation
[CP Staging] revert: refactor the new-transaction highlight rail and the wide RHP width model - #100810
Conversation
|
@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] |
|
@abzokhattab |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
There was a problem hiding this comment.
💡 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".
| // The table is visible whenever it's wide, or — on narrow — only when focused (the RHP has closed). | ||
| const isReportVisible = shouldUseNarrowLayout ? isFocused : true; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 👍 / 👎.
| 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); |
There was a problem hiding this comment.
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 👍 / 👎.
|
The It fails on one file, I can't fix it inside a revert. The Two things I checked before asking: the check has no baseline or ignore list like the eslint seatbelt does, and What should we do here @abzokhattab? I am also thinking to roll-forward all the related issues since they are minor highlight issues. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
There was a problem hiding this comment.
💡 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); |
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
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 👍 / 👎.
…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)
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.4.75-1 🚀
|
|
🤖 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 checkedThe diff is entirely internal. All 50 changed files are hooks, selectors, navigation/layout internals, and tests:
No user-facing copy changed. No files under No existing article documents this behavior. I searched Only internal-facing state changed shape. The stored shape of 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 |
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.4.75-3 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.4.76-0 🚀
|
|
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 What I checkedThe diff touches only internal code and tests — 50 files across:
No user-facing copy changed. Zero files under No docs were touched by the original PR either. #98744 changed the same 50 files, none under No affected help articles. I searched Feature names and labels: since no article text needs to change, there was nothing to verify against the live UI. @TaduJR, since no docs PR was created, there is no help site PR to review or mark view run · no recording available |
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.4.75-3 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.4.76-1 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Straight revert of #98744
Fixed Issues
$ #100757
$ #100761
$ #100763
$ #100770
$ #100771
$ #100782
$ #100787
$ #100789
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari