Repository navigation
Conversation
…ports-newTransactionHighlight-and-RHPLayout-followups # Conflicts: # src/components/WideRHPContextProvider/index.tsx # src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx # src/libs/Navigation/AppNavigator/useRHPScreenOptions.ts
|
@marufsharifi 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] |
|
Please ignore ESLint. It's failing on main. |
|
@TaduJR, could you please upload the records for all platforms. |
|
Yes already doing it currently
|
…ports-newTransactionHighlight-and-RHPLayout-followups
|
Added Desktop and Android demos. Having a little problem in latest Device Hub. It's prone to conflicts and resolving might take some time if occurring so feel free to review @marufsharifi Thanks for the patience 👍! |
|
@MelvinBot @codex review |
|
I reviewed the diff at head What I checked
These three changes in behavior look intentional. Please confirm:
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
…ports-newTransactionHighlight-and-RHPLayout-followups
BUG1:Test steps Prerequisite Steps
Expected Result
Actual Result
RF-1.mov |
I am seeing similar behaviour on staging. Could you double check |
BUG2:Steps Precondition: Steps:
Expected Result: Actual Result: RF-2.mov |
Just tested it. Same on staging as well. |
BUG3:Preconditions: Steps:
Expected result: Actual behavior:
RF-2.mov |
…ports-newTransactionHighlight-and-RHPLayout-followups # Conflicts: # src/components/Search/SearchList/ListItem/ChatListItem.tsx # src/components/Search/SearchList/ListItem/ExpenseReportListItem.tsx # src/components/Search/SearchList/ListItem/GroupChildrenContainer.tsx # src/components/Search/SearchList/ListItem/GroupHeader.tsx # src/components/Search/SearchList/ListItem/TaskListItem.tsx # src/components/Search/SearchList/ListItem/TransactionGroupListItem.tsx # src/components/Search/SearchList/ListItem/TransactionListItem/TransactionListItemNarrow.tsx # src/components/Search/SearchList/ListItem/TransactionListItem/TransactionListItemWide.tsx # src/components/Search/SearchList/ListItem/hooks/useSearchTableItemHighlight.ts # src/components/SelectionList/ListItemComposed/hooks/useListItemHighlight.ts # src/libs/Navigation/helpers/navigateAfterExpenseCreate.ts # src/libs/actions/IOU/NavigationHelpers.ts # src/libs/actions/IOU/Split.ts # src/libs/actions/IOU/TrackExpense.ts # tests/actions/IOU/SplitReportTotalsTest.ts # tests/actions/IOUTest/DuplicateTest.ts # tests/unit/useListItemHighlightTest.ts # tests/unit/useSearchTableItemHighlightTest.ts
|
@TaduJR, Gentle bump. |
|
@TaduJR, friendly bump. thanks. |
…ports-newTransactionHighlight-and-RHPLayout-followups # Conflicts: # src/components/MoneyRequestConfirmationList/sections/HighlightableExpenseFieldRow.tsx # src/components/MoneyRequestReportView/MoneyRequestReportTransactionItem.tsx # src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx # src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx # src/components/ReportActionItem/MoneyRequestReportPreview/useReportPreviewCarousel.tsx # src/components/ScreenWrapper/index.tsx # src/components/WideRHPContextProvider/index.tsx # src/components/WideRHPContextProvider/useRHPWidth/index.ts # src/hooks/useResponsiveLayoutOnWideRHP/index.ts # src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx # src/pages/iou/request/step/confirmation/submission/useDistanceSubmission.ts # src/pages/iou/request/step/confirmation/useExpenseSubmission.ts # src/selectors/ReportMetaData.ts # tests/ui/MoneyRequestReportTransactionsNavigationTest.tsx # tests/unit/hooks/useExpenseSubmission.test.ts
|
@MelvinBot @codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🤖 Code reviewI found 2 likely bugs and 3 risks worth a look. Nothing blocks merge outright, but the first two can cause a wrong highlight or a wrong panel width. Likely bugs
Risks
Findings I checked and dropped
Reviewed at |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
…ports-newTransactionHighlight-and-RHPLayout-followups # Conflicts: # src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx # src/libs/Navigation/helpers/cleanupAndNavigateAfterExpenseCreate.ts
|
Main has the same limit so follow-up for point 2 #102627 (comment) the others are invalid. Please continue with the review |
…ports-newTransactionHighlight-and-RHPLayout-followups
BUG#1:Steps:
Expected result: The chat preview scrolls to Eleventh receipt and highlights its card once. Actual result: The preview automatically scrolls to Test 10 and “+1 more.” The new expense never appears or flashes in the chat preview. Screen.Recording.2026-11-02.at.8.21.38.PM.mov |
BUG#2:Test steps:
Expected result: The expense is added and its row briefly highlights. Actual result: The expense is added, but its row does not highlight. Screen.Recording.2026-11-03.at.3.03.29.PM.mov |
|
@TaduJR, could you please check the last tow bugs reported. and resolve the conflicts. thanks. |
…ports-newTransactionHighlight-and-RHPLayout-followups # Conflicts: # src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx # src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx # src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx # src/components/ReportActionItem/TransactionPreview/TransactionPreviewContent.tsx # tests/unit/hooks/usePerDiemSubmission.test.ts
|
@TaduJR, Gentle bump. thanks. |
|
Already working on it! Thanks! |
|
@TaduJR, Quick bump. thanks. |
…ports-newTransactionHighlight-and-RHPLayout-followups # Conflicts: # tests/ui/SearchPageTest.tsx
It happens on The chat preview shows up to 10 expense cards, and the 11th spot is the "+N more" link. The preview sorts oldest first, so a new expense in a report that already has 10 lands in that 11th spot. The preview scrolls to it, but there's no card there to show or flash, only "+1 more". We need a product decision on this: skip the scroll when the new expense is behind "+N more", or always give a new expense one of the 10 cards. I'd rather handle it in a follow-up than in this PR.
I reproduced it, and this one came from this PR. It's fixed in the latest push. |
|
@TaduJR, could you please check the failure action. thanks. |
…ports-newTransactionHighlight-and-RHPLayout-followups
|
Was there already a discussion to move forward with this mega PR rather than splitting or beta? |
|
Yes here #96327 (comment) Also since this is a refactoring and not a feature I think beta will not work. |
…ports-newTransactionHighlight-and-RHPLayout-followups
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
situchan
left a comment
There was a problem hiding this comment.
Left code quality review.
Please check and address valid ones.
| setTimeout(() => scrollToNewTransaction(index, newTransaction?.transactionID), CONST.PENDING_TRANSACTION_SCROLL_DELAY); | ||
|
|
||
| // We only want to scroll to a new transaction when the set of new transaction IDs changes. | ||
| // We only want to scroll to a new transaction when the set of new transaction IDs changes, or when the chat is uncovered. | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [newTransactionIDs]); | ||
| }, [newTransactionIDs, isScreenVisible]); |
There was a problem hiding this comment.
Carousel scroll timer is never cleared
The effect starts a timer with no cleanup. Adding isScreenVisible to the deps means every cover and uncover of the chat queues another timer.
Fix:
const timer = setTimeout(() => scrollToNewTransaction(index, newTransaction?.transactionID), CONST.PENDING_TRANSACTION_SCROLL_DELAY);
return () => clearTimeout(timer);| import type ResponsiveLayoutOnWideRHPResult from './types'; | ||
|
|
||
| // Tests that mock @react-navigation/native partially leave this undefined. | ||
| const FallbackRouteContext = createContext<Route<string> | undefined>(undefined); |
There was a problem hiding this comment.
FallbackRouteContext is duplicated
It's the same context and the same useContext(NavigationRouteContext ?? FallbackRouteContext) read as in ScreenWrapper.
Fix: move it into one small hook, for example useRouteFromContext, and use it in both places.
| /** Whether each report showed rows when the current action began. From an action's second add the report includes the first, so every add uses the first answer. */ | ||
| const reportsShowingRowsWhenActionBegan = new Map<string, boolean>(); | ||
|
|
||
| /** Answers once per report per action. Cleared a microtask later, when the action's synchronous run ends. */ | ||
| function wasReportShowingRowsWhenActionBegan(reportID: string, isShowingRowsNow: () => boolean): boolean { | ||
| const isShowingRowsAtActionStart = reportsShowingRowsWhenActionBegan.get(reportID); | ||
| if (isShowingRowsAtActionStart !== undefined) { | ||
| return isShowingRowsAtActionStart; | ||
| } | ||
| const isShowingRows = isShowingRowsNow(); | ||
| const isFirstAnswerOfThisAction = reportsShowingRowsWhenActionBegan.size === 0; | ||
| reportsShowingRowsWhenActionBegan.set(reportID, isShowingRows); | ||
| if (isFirstAnswerOfThisAction) { | ||
| Promise.resolve().then(() => reportsShowingRowsWhenActionBegan.clear()); |
There was a problem hiding this comment.
Per-action cache depends on every add running synchronously
A module-level map remembers whether the report showed rows, and a microtask clears it. If an add flow ever awaits between adds, some rows get a highlight flag and others don't, and nothing at the call site warns about it.
Fix: work out the answer once in the caller and pass it into buildOnyxDataForMoneyRequest.
| const NO_RHP_ROUTE_KEYS: RHPRouteKeys = {wide: [], superWide: []}; | ||
|
|
||
| /** `width` includes a screen animating out; `displayed` does not. */ | ||
| let rhpRouteKeys: {width: RHPRouteKeys; displayed: RHPRouteKeys} = {width: NO_RHP_ROUTE_KEYS, displayed: NO_RHP_ROUTE_KEYS}; |
There was a problem hiding this comment.
RHP width keys are kept in two places
The same keys live in React state behind the context and in a module store filled by a layout effect. ScreenWrapper and useResponsiveLayoutOnWideRHP read the store, and about 20 other components read the context.
Fix: keep one source, or document in the provider when to use each.
| */ | ||
| function getVisibleRHPKeys(allSuperWideRHPKeys: string[], allWideRHPKeys: string[]): VisibleRHPKeys { | ||
| if (!navigationRef.isReady()) { | ||
| function getVisibleRHPKeys(state: NavigationState | undefined, allWideRHPKeys: string[], allSuperWideRHPKeys: string[], seenRouteKeys: ReadonlyMap<string, string>): VisibleRHPKeys { |
There was a problem hiding this comment.
Wide and super-wide arrays are passed in opposite orders
getVisibleRHPKeys now takes (wide, superWide). It used to take (superWide, wide), and getIsRHPDisplayedBelow still does. Both are string[], so a swap type-checks.
| if (transactions !== undefined && prevTransactions !== undefined && transactions.length > prevTransactions.length) { | ||
| if (skipFirstTransactionsChange.current) { | ||
| skipFirstTransactionsChange.current = false; | ||
| function useNewTransactions({ |
There was a problem hiding this comment.
useNewTransactions is hard to follow
App/src/hooks/useNewTransactions.ts
Lines 55 to 196 in 667dc7f
It takes 8 params and updates three pieces of state during render. Treating a load as settled also waits a microtask and a frame.
Fix: move the diff logic into a pure getNextDiffState(previous, input) like armedPlay.ts, and keep the hook to wiring.
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [newTransactionIDs]); | ||
| }, [newTransactionIDs, isScreenVisible]); |
There was a problem hiding this comment.
Lint suppression is no longer needed
scrollToNewTransaction is now an effect event, so the carouselTransactions lookup can move inside it.
Fix: move the lookup and drop the exhaustive-deps suppression.
| /** Highlight flags for transactions just added to this report, keyed `${transactionID}:${flaggedAt}`. */ | ||
| pendingNewTransactionIDs?: Record<string, true | null>; |
There was a problem hiding this comment.
pendingNewTransactionIDs no longer holds IDs
It now holds transactionID:flaggedAt keys, which the name hides.
Fix: rename it with a migration, or call it out as a known trade-off.
| skipInitialFade?: boolean; | ||
|
|
||
| /** Key of the item this row shows, so a recycled row isn't mistaken for the same one. `undefined` for a row that always shows the same thing. */ | ||
| highlightKey: string | undefined; |
There was a problem hiding this comment.
highlightKey is required even where it's always undefined
Four callers pass highlightKey: undefined.
Fix: make it optional, unless forcing every caller to choose is the point.
Explanation of Change
This brings back #98744, which was reverted in #100810 after eight deploy blockers. The changes are the same, and all eight blockers are fixed. Adding or duplicating an expense still highlights the new row, and the panel still widens when a report becomes a table.
Marking a new expense. When you add an expense, the app writes a note saying "highlight this row". The report's note is now written in one place instead of two that could disagree, and it's decided once per action: a report's first expenses are its contents, not additions, so opening a duplicated report no longer highlights its second expense (#100761). Each note records when it was written. Notes older than 60 seconds are ignored, clearing an old note can't remove a newer one, and a failed request removes its note.
Expenses added from elsewhere. The report table and the chat preview also compare their list before and after, to catch expenses that arrive from another device. Both wait until the whole report has loaded, so opening a report doesn't flash what was already there. Splitting an expense (#100757) and adding existing expenses to a report (#100789) now highlight the new rows.
When the flash plays. The new row appears right away; only the flash waits until you can see it. On desktop, a report dimmed under a narrower panel counts as visible and flashes straight away; on mobile it flashes when the panel closes (#94670). Each flash belongs to its expense, so it plays once, stays on the right row when the list re-sorts or scrolls, and doesn't replay when you open and close a report (#100763) or come back online (#100787). Brief highlights like the Tag row (#100771) and newly enabled workspace features (#100782) flash correctly. The table and the chat preview scroll to the new expense once you can see it.
The wide panel. Which screens are wide is now worked out from the navigation state instead of a copy kept in sync by hand. Clicking a report hands its width to the panel it opens, so the panel opens at its final width, and a closing panel keeps its width until its animation ends. #100770 is fixed by main's floating panel (#100811), so this PR doesn't touch that animation.
For reviewers.
useNewTransactionsnow compiles with React Compiler, and both core hooks drop their lint suppressions. The stored format ofpendingNewTransactionIDschanged: notes written by the current production build are ignored and cleaned up. Reassure shows no performance change, so none is claimed.Fixed Issues
$ #96327
PROPOSAL:
Tests
1. A duplicated expense flashes in the report behind (Desktop)
2. A duplicated expense flashes when you come back (Mobile)
3. Duplicating in a one-expense report switches to the table (Desktop)
4. Bulk duplicate
5. Adding an expense from the chat
6. Nothing flashes when it shouldn't
7. Old highlights don't come back
8. Splitting an expense (#100757)
9. The chat card doesn't flash on every open and close (#100763)
10. Duplicate report (#100761)
11. Duplicating while offline (#100787)
12. Adding existing expenses to a report (#100789)
13. Tag row on the create form (#100771)
14. Newly enabled workspace features (#100782)
15. Spend lists
16. Panel width (Desktop)
17. Panel after navigating (Desktop)
18. Panel transition stays inside the panel (#100770, Desktop)
Known behaviour, same as production (Please don't file)
Reopening a report within a few seconds of first seeing a new row can flash that row again.
When an empty report gets its first expense, its card in the chat flashes once when you return to the chat.
An expense opened more than 60 seconds after it was created doesn't flash. This is by design.
On mobile, if the report also has a scanned receipt and a distance expense, splitting an expense and then staying in the report for more than a few seconds means the split cards don't flash when you go back to the chat.
Duplicating from Spend > Expenses keeps you on the expense instead of switching to the report ([$250] Expense - Duplicated expense does not redirect to report table view #94427). This PR doesn't change that.
Verify that no errors appear in the JS console
Offline tests
Same as tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, 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.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-Native.mp4
Android: mWeb Chrome
Android-mWeb.mp4
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Mac-Chrome.mp4