Repository navigation
Standardize Expense Report and Expense header with predictable button placement and carousel counter - #100331
Conversation
…tton placement and carousel counter
|
Hey, I noticed you changed If you want to automatically generate translations for other locales, an Expensify employee will have to:
Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running: npx bun ./scripts/generateTranslations.ts --helpTypically, you'd want to translate only what you changed by running |
|
@ZhenjaHorbach 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] |
|
@ShridharGoel PR is not ready yet, I'm opening to to work with Melvin & Codex @ZhenjaHorbach Please ignore the ping, I and @ShridharGoel will work on this PR |
|
@MelvinBot Please do deep review this PR |
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: b3baa98c16
ℹ️ 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".
|
🤖 Deep review — 3 blockers, 11 should-fix. Static checks are green ( The ownership model in 🔴 Blockers1. Header and carousel disagree on which list to check — both sets of arrows disappear
Repro: report-grouped search with ≥2 reports → open a report with exactly 2 expenses (seeds Fix: share one predicate, or render 2. The Spend page seeds the carousel on page view and never releases it
The unscoped clear at Repro: open Spend (≥2 expenses), open nothing, switch to Inbox, tap a report preview for a one-transaction report whose expense is in the Spend list → header shows "k of 20" and the arrows navigate the Inbox pane to unrelated Spend expenses. 3.
|
| # | Where | Problem |
|---|---|---|
| 4 | DynamicReviewPage.tsx:193 |
The restore path re-stamps the previous screen's list with duplicate-review's own source, and drops snapshotHash/descriptors. getActiveTransactionIDs() returns source for exactly this and is unused here — and it never returns snapshotHash, so no caller can round-trip it. |
| 5 | Search/index.tsx:629 |
search:<hash> is not a stable owner identity. Sorting, filtering, or typing changes the hash on the same mounted screen, so shouldRefreshActiveTransactionIDs returns false permanently — the old source no longer exists on any screen. Masked only because row press writes unconditionally. |
| 6 | TransactionThreadNavigation.ts:144 |
if (ids.length < 2) return false means an owner can grow its carousel but never shrink or release it. Narrow a filter from 20 results to 1 and the RHP keeps paging the other 19. Also the root cause of blocker 1. |
| 7 | useNavigateToTransactionThread.ts:96 |
Row press omits descriptors and snapshotHash, which Onyx.sets them to null — defeating the guard at MoneyRequestReportTransactionList.tsx:610 that exists to protect snapshot-backed carousels. Snapshot-only siblings become unresolvable. |
| 8 | Search/index.tsx:642-648 |
The carousel is rewritten before the isModifiedMousePress early returns. Cmd+clicking a row to open it in a background tab silently replaces the current tab's carousel. |
| 9 | useNavigateToTransactionThread.ts:60 |
Left on getIOUActionForTransactionID while the carousel it seeds uses the new getExpenseCreationIOUActionForTransactionID. In an approved report the row press can land on the approval whisper while the carousel lands on the expense — the exact drift the new helper's docblock warns about. |
| 10 | MoneyRequestReportTransactionsNavigation.tsx:145-147 |
Not-yet-loaded siblings are kept (correct), but isNextButtonDisabled={!nextTransactionID} is then false while resolveSiblingReportID returns undefined → the arrow looks enabled and does nothing, with no spinner. |
| 11 | MoneyRequestReportNavigation.tsx:165-196 |
The new !isFocused early return is the only re-sync for allReportsCount, so pushing an RHP while the list shrinks leaves a stale total ("3 of 60"). On first mount with no persisted count it renders "1 of 0". Untested. |
| 12 | RecentlyAddedSection/index.tsx:60 |
Not updated for the two new ResolveReportContext fields (isSelfTourViewed, hasCompletedGuidedSetupFlow), so this entry point builds a different optimistic thread than the carousel does for the same expense. |
| 13 | RecentlyAddedSection/index.tsx:80, DynamicReviewPage.tsx:187, TransactionGroupListExpanded.tsx:243 |
Three carousel-seeding navigations omit the new anchorTransactionID. Recently-added is the worst omission — it's the snapshot-backed flow whose siblings are by construction absent from the live collections, i.e. the cold-open case the param was added for. |
| 14 | TransactionThreadNavigation.ts:53-56 |
The module mirror has no Onyx.clear() invalidation and the keys aren't in KEYS_TO_PRESERVE, so "Clear cache and restart" (no JS reload on any platform) leaves the mirror claiming a carousel Onyx no longer has — and both gates then suppress the repair write. The memo is pre-existing, but this PR widens the window a lot by adding a writer that never clears. |
Test-quality notes — the suites are green but several don't pin what they claim
MoneyRequestReportTransactionListActiveTransactionIDsTest.tsx:44-73andMoneyRequestReportNavigation.test.tsx:66-80test hand-copied duplicates of the hooks, not the components. Both pass while the real component regresses. The PR's headline claim (source-scoped clear fixes teardown ordering) is only ever exercised against ajest.fn().TransactionThreadNavigationTest.tsasserts only viagetActiveTransactionIDs()— the module mirror the code under test just wrote. Stub out all threeOnyx.setcalls and the file still passes. That is exactly finding 14.snapshotHashis passed in four tests and asserted in none.MoneyRequestReportTransactionsNavigation.test.tsx: the mockedPressablereceivesdisabled, so RNTL won't dispatch —expect(setParams).not.toHaveBeenCalled()passes trivially and can't distinguish "correctly disabled" from "handler bailed".useOnyxis fully mocked with populated state, so theundefined-first path (finding 10) is never exercised.useReviewFlaggedExpenses.test.ts:134-143: the primary path usesobjectContainingwithoutcarouselSource; deleting the source from the hook leaves the file green. The:194-216case is good — keep that shape.- Deleting
MoneyReportHeaderMoreContentTest.tsxlost the render-level assertion thatMoneyReportHeaderNextStepactually mounts;MoneyReportHeaderMoreContentisjest.mocked tonullin the placement test, so ashouldShowNextStepprop typo would ship green.
Nits
- DRY: the five-element IOU denylist is defined twice within this PR —
ReportActionsUtils.ts:2704-2711andMoneyRequestReportTransactionsNavigation.tsx:56-62— and both are the complement of the existingiouRequestTypes. Export one. getExpenseCreationIOUActionForTransactionIDreturns the first match;collectParentReportActionskeeps the last. Same conceptual lookup, opposite tiebreak.CAROUSEL_SOURCE.*(undefined)collapses toreport:undefined/search:undefined. Reachable atTransactionGroupListExpanded.tsx:262. Consider requiring a defined id in the type.setActiveTransactionIDsstores the caller's array by reference into both the mirror and Onyx;DynamicReviewPagehands the same object back in. A defensive[...ids]removes the class.- a11y:
PrevNextButtonssetsaccessibilityLabel={CONST.ROLE.BUTTON}on both arrows (pre-existing), so they announce as "button, button" with no link to the new counter — and the counter is hidden entirely on narrow layouts. - Perf:
snapshotParentReportActionsre-scans the whole snapshot on every prev/next press (prevTransactionID/nextTransactionIDare in its deps);Search/index.tsx:823addscarouselSiblingTransactionIDstoonSelectRow's deps, which churns with search data —carouselSiblingsKeyis already computed and stable. MoneyReportHeaderMoreContent.tsx:106:styles.pt0is dead — the row has no default padding.report_{reportID}is now subscribed three times in one tree; pass the loaded report intouseMoneyReportHeaderMoreContentVisibilityinstead of the ID.
Checked and clean
tsc0 errors repo-wide (bothtsconfig.jsonandtsconfig.jest.json); ESLint 0 errors on all 23 changed files (206 warnings, all pre-existing eslint-seatbelt entries); all 8 PR test suites pass, 89 tests. Formatting was not verified — App usesoxfmt, and I couldn't run it here; theOxfmt checkworkflow will cover it.- i18n:
common.currentOfTotalis present in all 11 locales with genuine translations (not English copies), used only viatranslate(), and it removes a hardcoded English${currentIndex + 1} of ${allReportsCount}that existed at base. Locale quote typography untouched. ROUTES.ts:anchorTransactionIDis an optional query param; the route string is unchanged, so no path position shifted,linkingConfigneeds no update, all 27 existing callers compile, and deeplinks are safe.Navigation/types.tsaddition is live — it's what makes the narrowedroute.params.anchorTransactionIDaccess atMoneyReportHeader.tsx:99legal.ONYXKEYS/ExportOnyxState: the new snapshot-hash key is typed correctly and correctly bucketed as safe (a bare hash), whileTHREAD_REPORT_IDScorrectly stays masked.- Real fix over base: the old code computed
at(currentTransactionIndex + 1)withcurrentTransactionIndex === -1, i.e.at(0)— "next" jumped to an unrelated first expense. The=== -1early-out fixes that. - Header action reachability:
MoneyReportHeaderActionsrenders exactly once across all three placement branches; no action becomes unreachable in any paid/approved/settled/exported or offline state. useMoneyReportHeaderMoreContentVisibilityis behaviour-identical to the inline logic it replaced.sizing.ts:mnw8: {minWidth: 32}matches the existing 4px-scale convention; no DRY violation. (It only stabilizes ~3 characters, so "9 of 50" → "10 of 50" still shifts the arrows.)shouldDisplaySearchRouterlosing the search button on narrow Search-opened reports looked like a regression but matches whatMoneyRequestHeaderalready did at all widths — deliberate standardization. Worth a line in the PR body.
I also tried a live web smoke test of the carousel on this branch, but the app never rendered past a blank screen in the test harness, so I couldn't attribute that to the PR either way. Everything above is from code, not runtime.
Reply with @MelvinBot <feedback> if you want me to dig into any of these further.
|
Let's try to hustle on this PR. It's been a long project and we're getting customer complaints about not having a count for expenses within the carousel for a batched report (which this PR delivers on). |
|
@ShridharGoel I think you can start review now |
|
Deploy Blocker #103112 was identified to be related to this PR. |
|
Deploy Blocker #103113 was identified to be related to this PR. |
|
Deploy Blocker #103114 was identified to be related to this PR. |
|
Deploy Blocker #103120 was identified to be related to this PR. |
|
Deploy Blocker #103122 was identified to be related to this PR. |
|
Deploy Blocker #103138 was identified to be related to this PR. |
|
Deploy Blocker #103184 was identified to be related to this PR. |
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.5.3-4 🚀
Bundle Size Analysis (Sentry): |
|
Thank you everyone for pushing on this PR. |
|
@thelullabyy why is "font-variant: tabular-nums" on by default? It's causing our 1's to have a serif, which we don't want. Can you follow up and fix please?
|
|
@shawnborton noted, I will fix it along with other follow-up PRs |
| setActiveTransactionIDs(visualOrderTransactionIDs, {source: carouselSource}); | ||
| hasSeededCarouselRef.current = true; | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps -- visualOrderTransactionIDsKey is an order-sensitive proxy for the array | ||
| }, [visualOrderTransactionIDsKey, carouselSource]); |
There was a problem hiding this comment.
This PR moved the carousel cleanup in useMoneyRequestReportActiveTransactionIDs.ts out of the effect that re-runs on visualOrderTransactionIDsKey, and added an early return for lists with fewer than two rows. After an expense is removed from a two-expense report, the stale carousel list is no longer cleared, so the arrows and the "1 of 2" counter stay visible and lead to the self DM.
This was fixed here: #103998
More information is available here: #103944
|
@thelullabyy did we ever fix the tabular numbers? I still see it in the product: |
|
@shawnborton I will manage it today |
| // Nothing to inspect, so keep the ID only while a descriptor still vouches for the sibling. | ||
| return !!siblingDescriptors?.[transactionID]; | ||
| } | ||
| return !isTransactionPendingDelete(transaction) && !isDeletedTransaction(transaction); |
There was a problem hiding this comment.
Coming from #104307.
This PR added the carousel arrows to MoneyReportHeader. This filter only drops deleted and pending-delete expenses. Splitting an expense moves the original to SPLIT_REPORT_ID (-2) without deleting it, so it stays in the list. After both splits are deleted, the report with one expense left shows "1 of 2", and the arrow opens /e/-2 ("It's not here").
Fixed in #105671: the split action now removes the original from the carousel, and this filter also skips split originals (isSplitContainerTransaction).


Explanation of Change
Fixed Issues
$ #90366
PROPOSAL: N/A
Tests
Log in with a test account that has access to a paid workspace with multiple expense reports and expenses
Have these in your test workspace:
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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
Screen.Recording.2026-05-17.at.23.29.29.mov
Bug: #96563
Android: mWeb Chrome
Screen.Recording.2026-05-17.at.23.25.25.mov
iOS: Native
iOS: mWeb Safari
Screen.Recording.2026-05-17.at.23.21.16.mov
MacOS: Chrome / Safari
Screen.Recording.2026-05-17.at.23.15.10.mov
Screen.Recording.2026-07-27.at.20.19.00.mov
Screen.Recording.2026-07-27.at.21.06.31.mov