You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-09-09] [$250] Existing expenses get highlighted when opening a report #98308
Version Number: 9.4.52-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@FitseTLT Slack conversation (hyperlinked to channel name): #expensify_bugs
Action Performed:
Prerequisites: User has multiple expense reports in different workspace chats
The highlight-on-open animation is driven entirely by a "rail" of transaction IDs (REPORT_METADATA.pendingNewTransactionIDs) that gets written at expense-creation time, not at report-open time. When you open a report, useNewTransactions deliberately skips its render-diff path on the first mount (skipFirstTransactionsChange), so on a fresh open the rail is the only thing that can highlight any row.
So a transaction is never flagged for highlight when it is the first/only expense in the report (addMakesReportMultiTransaction requires the report to already contain another non-deleted transaction, i.e. the 0→1 add is excluded), or when the creating flow passes shouldSkipReportHighlightRail. Any expense not on the rail shows no highlight when its report is opened — which matches "existing expenses are not highlighted when opening a report."
What changes do you think we should make in order to solve the problem?
Decide the intended scope of the highlight and adjust the write-side gate accordingly:
If single-expense reports should highlight on open, relax the addMakesReportMultiTransaction condition so the first (0→1) transaction is also flagged onto the rail.
Audit which creation flows pass shouldSkipReportHighlightRail (added recently by #97520) and confirm none of them actually do land on a report the user then opens.
Investigation details, evidence & the wording contradiction
Read side is correctly wired — MoneyRequestReportActionsList.tsx:157-160 reads pendingNewTransactionIDs and passes all args to useNewTransactions. The rows consume the result through useAnimatedHighlightStyle. When no highlight appears, the rail was never written — so the bug is on the write side.
Temporally-closest changes (issue reported at v9.4.52-0 ~2026-08-11):
#97520 "Fix stale split highlights when splitting from the Spend page" — merged 2026-08-07 (4 days before). Added the shouldSkipReportHighlightRail param to the same write condition. Strongest recent-regression suspect.
#94670 "Highlight animation is visible on added expense after duplication" — merged 2026-07-13. Introduced the addMakesReportMultiTransaction gate that excludes the first/only transaction.
⚠️ The issue wording is internally contradictory — the title says existing expenses get highlighted (i.e. shouldn't), while Expected/Actual say they should be highlighted but aren't. These point at opposite fixes:
If the real complaint is "newly-added / first expenses should flash on open but don't" → the rail gate above is the root cause (this proposal).
If the real complaint is "existing/old expenses are wrongly flashing on open" → look instead at the rail not being cleared, or prevTransactions resetting to undefined on a remount so the next length increase is misread as new.
Testing note: I couldn't reproduce live — the test session failed to render the app (infra issue), so this is code-evidence-based (Medium confidence). A quick confirmation of whether the affected reports are single-expense (0→1, directly explained by addMakesReportMultiTransaction) or multi-expense would firm this up.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/98308) to create a draft PR. To refine:@MelvinBot <your feedback> — in particular, please confirm which behavior is expected (highlight the first/only expense on open, vs. stop existing expenses from flashing). To reject: Explain why you are rejecting Melvin's proposal.
@FitseTLT (original reporter) could you clarify: when you say "existing expenses get highlighted," do you mean:
Expenses that were recently added (by you or someone else) and you're seeing the report for the first time since, should flash so you notice them, or
Something else entirely (e.g. a specific expense you were sent to via link should be visibly indicated)?
Not only as original reporter but also as original developer of the feature the intention was to show where new expense you created were added by scrolling and highlighting the expense on the report preview but now on this issue I see old expenses being highlighted.
Please re-state the problem that we are trying to solve in this issue.
Only a genuinely newly added expense should scroll into view and highlight, and it should happen once. An expense that was already highlighted must not flash again later merely because the user reopens the report or the report regains navigation focus.
The reporter’s clarification is important here: the original feature was built to highlight the new expense the user just created, but the current defect is that old expenses are being highlighted. So the earlier interpretation that every existing expense should highlight on report open is inverted.
What is the root cause of that problem?
The stale highlight comes from a mismatch between actual report-table visibility and navigation focus when consuming REPORT_METADATA.pendingNewTransactionIDs.
Money-request creation records the new transaction ID in pendingNewTransactionIDs. useNewTransactions() treats every still-truthy ID on that rail as new, including on a fresh mount where a render-to-render diff cannot help.
MoneyRequestReportActionsList correctly defines whether the table is visible as:
narrow layout: visible only while the report route is focused;
wide layout: visible even when another RHP is stacked above it.
However, useNewTransactions() is passed the raw isFocused value instead. Its cleanup effect refuses to delete the pending ID whenever isFocused === false.
Therefore, on wide layout the row can be visibly highlighted while the report route is not focused, but the rail entry is not consumed. The persisted ID survives. When the report later remounts or is reopened, the same already-seen transaction is read from the rail again and is incorrectly treated as new.
In other words, one layer says “the highlight was visible and delivered,” while the lifecycle layer says “the report was not focused, so keep the highlight for later.” That disagreement is what converts a new expense into an old expense that repeatedly flashes.
Relevant code:
useNewTransactions.ts — rail entries are returned as new and are cleared only when the final argument is not false.
MoneyRequestReportActionsList.tsx — computes isReportVisible, but passes raw isFocused to the hook while passing isReportVisible to the list.
What changes do you think we should make in order to solve the problem?
Change the final useNewTransactions() argument from navigation-specific isFocused semantics to actual visibility/consumption semantics, preferably renaming it to isReportVisible or shouldConsumePendingHighlights.
Pass the already-computed isReportVisible value from MoneyRequestReportActionsList into the hook.
Clear only the truthy pending IDs whose transactions were actually resolved into newTransactions, and only after the table was visible and had the opportunity to scroll/highlight them.
Preserve the intended narrow-layout behavior: while a transaction RHP fully covers the report, keep the rail; when the RHP closes and the table becomes visible, highlight once and then clear it.
Do not relax the write-side gate to mark every existing transaction as new. The reporter clarification confirms that old rows should not be highlighted just because a report opens.
This is a small semantic alignment: the same visibility decision must control both rendering the animation and acknowledging that it was delivered.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Wide layout + stacked RHP: the report table is visible but its route is not focused; a new transaction highlights immediately, its pending ID is cleared, and reopening the report does not highlight it again.
Narrow layout + stacked RHP: the table is covered; the pending ID remains until the RHP closes, then highlights exactly once and is cleared.
Fresh remount after consumption: a tombstoned/cleared rail never produces an old highlight.
Consecutive additions: multiple truthy IDs are consumed without re-highlighting an earlier transaction while a newer one is added.
Diff-only/Pusher additions: transactions detected by the normal render diff still behave exactly as before and do not depend on the metadata rail.
What alternative solutions did you explore? (Optional)
Clearing the rail immediately when the transaction is created would prevent duplicates, but would break the pre-mount/narrow-layout case the rail exists to solve.
Clearing whenever isFocused becomes true is too late for wide layouts and is the current source of stale IDs.
Removing the rail entirely would regress 1→2 report transitions and other cases where the table mounts after the optimistic transaction already exists.
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Precondition:
An account with several workspace chats, each containing expense reports with more than one expense.
Test:
Clear the app cache / storage and reload.
Open the Inbox and let a chat with expense report previews load.
Verify no preview flashes the yellow highlight on existing expenses.
Switch to another chat with expense previews, then back to the first one.
Verify no preview flashes the highlight on either chat.
Open a long chat via a link to an older report action (e.g. /r//), then scroll to pull more report actions into the list.
Verify none of the existing previews flash the highlight as the expenses are existing ones.
Activity
MelvinBot commentedon Aug 11, 2026
Proposal
What is the root cause of that problem?
The highlight-on-open animation is driven entirely by a "rail" of transaction IDs (
REPORT_METADATA.pendingNewTransactionIDs) that gets written at expense-creation time, not at report-open time. When you open a report,useNewTransactionsdeliberately skips its render-diff path on the first mount (skipFirstTransactionsChange), so on a fresh open the rail is the only thing that can highlight any row.That rail is only written under a narrow gate in
MoneyRequestBuilder.ts:696-698:So a transaction is never flagged for highlight when it is the first/only expense in the report (
addMakesReportMultiTransactionrequires the report to already contain another non-deleted transaction, i.e. the 0→1 add is excluded), or when the creating flow passesshouldSkipReportHighlightRail. Any expense not on the rail shows no highlight when its report is opened — which matches "existing expenses are not highlighted when opening a report."What changes do you think we should make in order to solve the problem?
Decide the intended scope of the highlight and adjust the write-side gate accordingly:
addMakesReportMultiTransactioncondition so the first (0→1) transaction is also flagged onto the rail.shouldSkipReportHighlightRail(added recently by #97520) and confirm none of them actually do land on a report the user then opens.Investigation details, evidence & the wording contradiction
Read side is correctly wired —
MoneyRequestReportActionsList.tsx:157-160readspendingNewTransactionIDsand passes all args touseNewTransactions. The rows consume the result throughuseAnimatedHighlightStyle. When no highlight appears, the rail was never written — so the bug is on the write side.Temporally-closest changes (issue reported at v9.4.52-0 ~2026-08-11):
shouldSkipReportHighlightRailparam to the same write condition. Strongest recent-regression suspect.addMakesReportMultiTransactiongate that excludes the first/only transaction.prevTransactionsresetting toundefinedon a remount so the next length increase is misread as new.Testing note: I couldn't reproduce live — the test session failed to render the app (infra issue), so this is code-evidence-based (Medium confidence). A quick confirmation of whether the affected reports are single-expense (0→1, directly explained by
addMakesReportMultiTransaction) or multi-expense would firm this up.Related issues
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/98308)to create a draft PR.To refine:
@MelvinBot <your feedback>— in particular, please confirm which behavior is expected (highlight the first/only expense on open, vs. stop existing expenses from flashing).To reject: Explain why you are rejecting Melvin's proposal.
melvin-bot commentedon Aug 11, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @huult (
External)melvin-bot commentedon Aug 11, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022087180851797218406
huult commentedon Aug 12, 2026
@FitseTLT (original reporter) could you clarify: when you say "existing expenses get highlighted," do you mean:
FitseTLT commentedon Aug 12, 2026
Not only as original reporter but also as original developer of the feature the intention was to show where new expense you created were added by scrolling and highlighting the expense on the report preview but now on this issue I see old expenses being highlighted.
huult commentedon Aug 13, 2026
@FitseTLT Ah, could you mention the PR where you implemented this feature? thank you 😄
FitseTLT commentedon Aug 13, 2026
#81446
skrohan5016-coder commentedon Aug 14, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Only a genuinely newly added expense should scroll into view and highlight, and it should happen once. An expense that was already highlighted must not flash again later merely because the user reopens the report or the report regains navigation focus.
The reporter’s clarification is important here: the original feature was built to highlight the new expense the user just created, but the current defect is that old expenses are being highlighted. So the earlier interpretation that every existing expense should highlight on report open is inverted.
What is the root cause of that problem?
The stale highlight comes from a mismatch between actual report-table visibility and navigation focus when consuming
REPORT_METADATA.pendingNewTransactionIDs.pendingNewTransactionIDs.useNewTransactions()treats every still-truthy ID on that rail as new, including on a fresh mount where a render-to-render diff cannot help.MoneyRequestReportActionsListcorrectly defines whether the table is visible as:isReportVisiblevalue, so on wide layout it is allowed to show the highlight in the background while the transaction-detail RHP is still open. That behavior is intentional and is explicitly covered by PR fix: Reports - Highlight animation is visible on added expense after duplication #94670.useNewTransactions()is passed the rawisFocusedvalue instead. Its cleanup effect refuses to delete the pending ID wheneverisFocused === false.In other words, one layer says “the highlight was visible and delivered,” while the lifecycle layer says “the report was not focused, so keep the highlight for later.” That disagreement is what converts a new expense into an old expense that repeatedly flashes.
Relevant code:
useNewTransactions.ts— rail entries are returned as new and are cleared only when the final argument is notfalse.MoneyRequestReportActionsList.tsx— computesisReportVisible, but passes rawisFocusedto the hook while passingisReportVisibleto the list.PendingNewTransactions.ts— the rail is persisted in report metadata until explicitly tombstoned.What changes do you think we should make in order to solve the problem?
useNewTransactions()argument from navigation-specificisFocusedsemantics to actual visibility/consumption semantics, preferably renaming it toisReportVisibleorshouldConsumePendingHighlights.isReportVisiblevalue fromMoneyRequestReportActionsListinto the hook.newTransactions, and only after the table was visible and had the opportunity to scroll/highlight them.This is a small semantic alignment: the same visibility decision must control both rendering the animation and acknowledging that it was delivered.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
What alternative solutions did you explore? (Optional)
isFocusedbecomes true is too late for wide layouts and is the current source of stale IDs.huult commentedon Aug 17, 2026
Still checking
huult commentedon Aug 17, 2026
Screen.Recording.2026-08-17.at.13.58.51.mov
@MelvinBot's proposal doesn't work, so we need 🆘 C+ Help Wanted.
60 remaining items
huult commentedon Sep 3, 2026
Contributor+ Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: https://github.com/Expensify/App/pull/83925/changes#r3920316066
Link to the comment on the Issue:
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
melvin-bot commentedon Sep 8, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Sep 8, 2026
Payment Summary
Resolving PRs:
Fix - Existing expenses get highlighted when opening a report #99577
Reviewer: @huult owed $250 via NewDot
Reviewer: @FitseTLT owed $250 via NewDot
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Sep 10, 2026
Payment Summary
Contributor: @FitseTLT due $250 via NewDot
Contributor+: @huult due $250 via NewDot
flaviadefaria commentedon Sep 11, 2026
Approved: @FitseTLT due $250 via NewDot
JmillsExpensify commentedon Oct 14, 2026
$250 approved for @huult