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-08-08] [$250] Notification appears when user is focused on the report #95711
Version Number: 9.4.32-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:#95318 Email or phone of affected tester (no customers):gocemate+buzz1833@gmail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: windows 10/chrome App Component: Notifications
Action Performed:
Precondition: User A has a one-single expense report
Steps:
Open the one-single expense report as User A
As User B, open the transaction thread (you can invite the user by mentioning them on the report)
As User B, send a message on the transaction thread
While the report is open as User A, verify no notification appears
NOTE: if you open both users on the same device (even with different tab/browser), on step 4, make sure the User A tab is open and focused (you can click into the app to make it focus)
Expected Result:
No notification should appear since user is focused on the report
Actual Result:
Notification appears when user is focused on the report
This is a regression from #95318 (deployed to staging in the reported version 9.4.32-0) — QA already flagged step 4 failing on that PR. The suppression code #95318 added is in main but it doesn't actually fire in this flow.
Root Cause: The "don't notify me for the transaction thread of the report I'm viewing" check compares the incoming action's real transaction-thread reportID against topmostOneTransactionThreadReportID at Report/index.ts:4616. For User A (a viewer who never created the expense and never opened the thread), the single IOU action has no childReportID, so getOneTransactionThreadReportID falls back to the sentinel string CONST.FAKE_REPORT_ID ('FAKE_REPORT_ID'). 'FAKE_REPORT_ID' === '<real thread id>' is always false → the check never suppresses → the notification shows.
Recommended Fix: Don't rely on the viewer's (often-empty) childReportID. Instead, suppress by checking the incoming thread's own parent link: if the report for the incoming reportID is a transaction thread whose parentReportID equals topmostReportID (the one-transaction report being viewed), suppress. The thread report always carries parentReportID from the server, so this doesn't depend on the optimistic childReportID. At minimum, also guard the existing comparison so a FAKE_REPORT_ID value can never be treated as a match.
Investigation details & evidence
Data flow (local Pusher path):
User A focuses the one-transaction expense report → getTopmostReportId() = expenseReportID.
useOneTransactionThreadReportID(expenseReportID) finds the single IOU action correctly, but returns iouAction.childReportID ?? CONST.FAKE_REPORT_ID → ReportActionsUtils.ts:1972. On a viewer's client childReportID is unset (it's only set optimistically for the expense creator — ReportUtils.ts:8894), so it returns 'FAKE_REPORT_ID'.
User B posts on the real transaction thread → triggerNotifications passes the real thread reportID.
Why #95318's QA missed it: the tests in tests/unit/showReportActionNotificationTest.ts always pass topmostOneTransactionThreadReportID as undefined, so the L4616 branch is never exercised with a real incoming thread ID + the FAKE_REPORT_ID fallback. A regression test should set up a one-transaction report as topmost (viewer has no childReportID), an incoming action on the real thread ID with visibility/focus true, and assert no notification fires.
Ruled out: wrong topmost report (the expense report's actions are read correctly), wrong incoming reportID (it's the correct real thread ID), and leader/staleness (leader check already passed; ref update is a tick behind at most — secondary).
Confidence: High — deterministic code path, verified end-to-end with file:line evidence. Since this is a fresh regression from a just-merged PR, bernhardoj (PR author) may be best placed to fold the fix into a follow-up.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/95711) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
🚨 Edited by proposal-police: This proposal was edited at 2026-07-20 09:16:56 UTC.
Proposal
What is the root cause of that problem?
The notification suppression path now depends on a precomputed topmostOneTransactionThreadReportID: AuthScreensInitHandler derives it from the focused report and passes it to Pusher callbacks (
). shouldShowReportActionNotification() only suppresses a transaction-thread notification when the incoming reportID exactly equals that precomputed thread ID (
// Due to payload size constraints, some push notifications may have their report action stripped
).
The problem is that the focused report ID used to compute topmostOneTransactionThreadReportID can be incorrect on wide/RHP flows. AuthScreensInitHandler currently derives the focused report from Navigation.getTopmostReportId(), but that helper only reads the report from REPORTS_SPLIT_NAVIGATOR. When a one-transaction expense report is visible in the RHP/super-wide RHP, the central pane can still hold the parent chat, so Navigation.getTopmostReportId() can return the background chat report ID instead of the expense report ID that the user is actually viewing. This matches the C+ feedback that the report ID is incorrect before reload.
The read-only/composer-blocked case after reload looks like a separate permission issue, as discussed in the latest comments. However, the notification bug still applies to the valid expense-in-DM flow, where the user is focused on the related one-transaction report/thread context but the notification suppression still uses the wrong focused report source. Because the global notification path can start from the background split report instead of the visible expense report, it can compute undefined or an unrelated topmostOneTransactionThreadReportID, so a new message on the related transaction thread is treated as a different report and the browser notification is shown.
What changes do you think we should make in order to solve the problem?
First, derive the currently viewed report ID from the visible report context, not only from Navigation.getTopmostReportId(). When a report is open in the RHP/super-wide RHP, prefer that report ID; otherwise fall back to the current Navigation.getTopmostReportId() behavior. Then pass this corrected focused report ID into useOneTransactionThreadReportID().
Also update the direct foreground push-notification derivation in shouldShowPushNotification() to use the corrected currently viewed report ID before deriving topmostOneTransactionThreadReportID (
). That keeps local web notifications and native foreground push notifications aligned.
Use the same corrected currently viewed report ID in shouldShowReportActionNotification() for the direct current-report comparison, so both notification suppression checks use the same source of truth for the report the user is actually focused on.
What alternative solutions did you explore? (Optional)
I considered broadening shouldShowReportActionNotification() to suppress any notification whose report is a child of the current report, but that would incorrectly hide transaction-thread notifications for multi-transaction reports where the thread message is not actually visible in the parent report. The safer fix is to make the “currently viewed report” source of truth use the correct visible report ID for notification suppression.
I also considered changing Navigation.getTopmostReportId() globally, but that helper is used by many unrelated callers that may intentionally want the split-navigator report. Keeping the RHP-first behavior scoped to notification suppression avoids changing broader navigation semantics.
🚨 Edited by proposal-police: This proposal was edited at 2026-07-10 13:12:53 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When User A is focused on a one-transaction expense report and User B sends a message on that report's transaction thread, a notification is shown to User A even though they are actively viewing the report.
What is the root cause of that problem?
shouldShowReportActionNotification decides whether the user is currently viewing the relevant report using two "topmost report" values, and both of them resolve through Navigation.getTopmostReportId():
Log.info(`${tag} No notification because the report is a transaction thread associated with the current one-transaction report`);
returnfalse;
}
indirectly, for the one-transaction-thread check: AuthScreensInitHandler derives topmostOneTransactionThreadReportID from useRootNavigationState(Navigation.getTopmostReportId) and hands it to the Pusher callback
But a one-transaction expense report is normally not viewed on that screen:
On wide layouts (the repro platforms: Windows/Chrome, macOS/Chrome), opening the expense report from the chat opens it in the super-wide RHP (SCREENS.RIGHT_MODAL.EXPENSE_REPORT / SCREENS.RIGHT_MODAL.SEARCH_MONEY_REQUEST_REPORT), while the central pane underneath still holds the parent chat. In this state getTopmostReportId() keeps returning the parent chat's reportID — a value that is wrong, not just missing.
When the report is opened from the Reports tab, it renders on SCREENS.SEARCH.MONEY_REQUEST_REPORT inside SEARCH_FULLSCREEN_NAVIGATOR, where getTopmostReportId() returns undefined.
In both cases useOneTransactionThreadReportID(topmostReportID) is fed the wrong report (the parent chat, or undefined), so it returns undefined, the reportID === topmostOneTransactionThreadReportID check never matches, and the notification fires even though User A is focused on the report. The Airship push path has the same blind spot, since it computes topmostOneTransactionThreadReportID from Navigation.getTopmostReportId() too:
This also means the bug is not really a regression of #95318: both before and after that PR, the "which report is the user viewing" resolution only ever looked at the split navigator; viewing the report in the RHP or the Reports tab was simply never covered by this code path.
What changes do you think we should make in order to solve the problem?
Add a getCurrentlyViewedReportID helper in Navigation.ts that resolves the report in visual stacking order — the RHP first, because an open wide/super-wide RHP renders above the central pane, so checking getTopmostReportId() first would short-circuit on the chat underneath it. I deliberately keep getTopmostReportId itself untouched since it has ~24 call sites with navigation semantics we don't want to change. Navigation.ts already imports ALL_WIDE_RIGHT_MODALS, and useCurrentReportID already sets the precedent of resolving RHP report params separately from the split navigator (getFocusedRouteReportID):
functiongetCurrentlyViewedReportID(state: NavigationState=navigationRef.getRootState()): string|undefined{// A report open in the wide / super-wide RHP (EXPENSE_REPORT, SEARCH_MONEY_REQUEST_REPORT, SEARCH_REPORT)// renders above the central pane, so it must be resolved first: while an RHP is open,// getTopmostReportId() still returns the central-pane chat underneath it.constlastRootRoute=state?.routes?.at(-1);if(lastRootRoute?.name===NAVIGATORS.RIGHT_MODAL_NAVIGATOR){consttopmostWideRHPRoute=lastRootRoute.state?.routes?.findLast((route)=>ALL_WIDE_RIGHT_MODALS.has(route.name));constrhpReportID=(topmostWideRHPRoute?.paramsas{reportID?: string}|undefined)?.reportID;if(rhpReportID){returnrhpReportID;}}// An expense report opened from the Reports tab renders on SCREENS.SEARCH.MONEY_REQUEST_REPORT inside// SEARCH_FULLSCREEN_NAVIGATOR (nested in TAB_NAVIGATOR), which getTopmostReportId() cannot see either.// Only consult it when the Search navigator is the focused full-screen tab.consttabState=state?.routes?.findLast((route)=>route.name===NAVIGATORS.TAB_NAVIGATOR)?.state;constfocusedTabRoute=tabState?.routes?.at(tabState.index??-1);if(focusedTabRoute?.name===NAVIGATORS.SEARCH_FULLSCREEN_NAVIGATOR){constsearchState=focusedTabRoute.state;constfocusedSearchRoute=searchState?.routes?.at(searchState.index??-1);if(focusedSearchRoute?.name===SCREENS.SEARCH.MONEY_REQUEST_REPORT){return(focusedSearchRoute.paramsas{reportID?: string}|undefined)?.reportID;}}// Central-pane report — the existing behavior.returngetTopmostReportId(state);}
Then use it in the three places that drive the notification "am I viewing this report" logic.
In shouldShowReportActionNotification (also fixes the plain "current report" check for messages sent to the RHP-open report itself):
With topmostReportID now resolving to the expense report, useOneTransactionThreadReportID returns the transaction thread's reportID, the one-transaction-thread guard matches the incoming notification, and it is correctly suppressed.
What specific scenarios should we cover in automated tests to prevent this bug from reoccurring?
getCurrentlyViewedReportID with mocked navigation states: an expense report open in the super-wide RHP over a central-pane chat returns the expense report's reportID (not the chat's); a wide SEARCH_REPORT RHP returns its reportID; a focused SCREENS.SEARCH.MONEY_REQUEST_REPORT in the Search tab returns its reportID; a plain central-pane SCREENS.REPORT keeps the existing behavior.
shouldShowReportActionNotification returns false for a transaction-thread notification when the associated one-transaction expense report is currently viewed (visible + focused) in each of those navigation contexts.
It still returns true when the same report is not the currently viewed report, or the window is not focused, confirming we didn't over-suppress.
What alternative solutions did you explore? (Optional)
Extend getTopmostReportParams itself to also look at the RHP and search screens, so every consumer of getTopmostReportId transparently benefits. I ruled this out as the primary approach because getTopmostReportId is consumed by ~24 navigation-related call sites (LHN highlighting, back navigation, unread handling), and broadening its meaning risks subtle regressions elsewhere; scoping the change to the notification path is safer.
Fixing useOneTransactionThreadReportID's useOnyx selector (it closes over report/chatReport without passing them as the dependencies argument, so the cached result can go stale). That is worthwhile hardening for the central-pane flow and could be included in the PR, but it cannot fix this issue on its own: whenever the report is viewed in the RHP or the Reports tab, the hook's input topmostReportID is already the wrong report (the parent chat or undefined), so its output can never be the right thread ID no matter how fresh the selector is.
Please re-state the problem that we are trying to solve in this issue.
When User A has a single-expense report open and focused, and User B sends a message in that expense's transaction thread, User A still receives a notification — even though they are already viewing the report whose thread received the message.
What is the root cause of that problem?
This is a regression introduced by #95318 (merged 2026-07-08), which moved the local-notification path off of Onyx.connect(). Previously, shouldShowReportActionNotification read the topmost report and its actions from module-level connectWithoutView subscriptions in Report/index.ts (where allReportActions was keyed by bare reportID, old line 474) and computed getOneTransactionThreadReportIDinline with always-fresh data.
#95318 replaced that with a new hook whose result is cached in a ref (AuthScreensInitHandler.tsx:93-99) and handed to the Pusher callback (User.ts:979 → shouldShowReportActionNotification). The hook reads report and chatReport from two separateuseOnyx subscriptions, then consumes them inside the REPORT_ACTIONS selector (src/hooks/useOneTransactionThreadReportID.tsx:10-14):
But Onyx memoizes a useOnyx selector against its own key's data only. In react-native-onyx/dist/useOnyx.js:60-78 the memoized selector recomputes only when lastInput !== input (the actions changed) or the dependencies array changed. No dependencies array is passed here, so when report/chatReport arrive after the selector has cached its result, the cached value goes stale — and because report is still undefined at that moment, getOneTransactionThreadReportAction early-returns at the report?.type guard (ReportActionsUtils.ts:1898), so the cached value is undefined. The ref then holds undefined, the reportID === topmostOneTransactionThreadReportID check in Report/index.ts:4616 fails, and the notification fires.
(The Airship push path in shouldShowPushNotification.ts:59-64 computes topmostOneTransactionThreadReportID inline from connectWithoutView data, so it is unaffected — the broken path is the local one that fires when the tab is online and focused.)
What changes do you think we should make in order to solve the problem?
Pass the external closure values as the third dependencies argument — the exact mechanism Onyx provides for selectors that depend on other keys (useOnyx.js:116-134 invalidates the cache and forces a recompute when dependencies change; signature useOnyx(key, options, dependencies?) at useOnyx.d.ts:25). This matches the existing codebase idiom (usePolicyForTransaction.ts:42, useSelectionModeReportActions.ts:69, usePolicyData/index.ts:47):
That single change makes the selector recompute whenever report, chatReport, or connectivity changes, so the cached topmostOneTransactionThreadReportID always reflects the report User A is viewing and shouldShowReportActionNotification correctly suppresses the notification.
What alternative solutions did you explore? (Optional)
Computing getOneTransactionThreadReportID(...) via useMemo over the three useOnyx results instead of a selector. Also correct, but it discards the selector's re-render optimization (the reason #95318 introduced the hook) and re-renders AuthScreensInitHandler on every REPORT_ACTIONS update. The dependencies argument preserves #95318's intent with a one-line, idiomatic fix.
changed the title [-]Notification appears when user is focused on the report[/-][+][$250] Notification appears when user is focused on the report[/+]on Jul 9, 2026
[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: I don't think this is a regression from a previous PR. It's an edge case caused by mixing some changes from the navigation refactor and the report view implementation
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:
[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.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Activity
applause-bot commentedon Jul 9, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/4c61004453dacadaa5a21083ce388661647a65d0cc0abede2f65f8e42bb3b7e1
MelvinBot commentedon Jul 9, 2026
Issue Analysis
This is a regression from #95318 (deployed to staging in the reported version
9.4.32-0) — QA already flagged step 4 failing on that PR. The suppression code #95318 added is inmainbut it doesn't actually fire in this flow.Root Cause: The "don't notify me for the transaction thread of the report I'm viewing" check compares the incoming action's real transaction-thread reportID against
topmostOneTransactionThreadReportIDatReport/index.ts:4616. For User A (a viewer who never created the expense and never opened the thread), the single IOU action has nochildReportID, sogetOneTransactionThreadReportIDfalls back to the sentinel stringCONST.FAKE_REPORT_ID('FAKE_REPORT_ID').'FAKE_REPORT_ID' === '<real thread id>'is always false → the check never suppresses → the notification shows.Recommended Fix: Don't rely on the viewer's (often-empty)
childReportID. Instead, suppress by checking the incoming thread's own parent link: if the report for the incomingreportIDis a transaction thread whoseparentReportIDequalstopmostReportID(the one-transaction report being viewed), suppress. The thread report always carriesparentReportIDfrom the server, so this doesn't depend on the optimisticchildReportID. At minimum, also guard the existing comparison so aFAKE_REPORT_IDvalue can never be treated as a match.Investigation details & evidence
Data flow (local Pusher path):
getTopmostReportId()= expenseReportID.useOneTransactionThreadReportID(expenseReportID)finds the single IOU action correctly, but returnsiouAction.childReportID ?? CONST.FAKE_REPORT_ID→ReportActionsUtils.ts:1972. On a viewer's clientchildReportIDis unset (it's only set optimistically for the expense creator —ReportUtils.ts:8894), so it returns'FAKE_REPORT_ID'.triggerNotificationspasses the real thread reportID.shouldShowReportActionNotification:realID !== expenseReportID(L4610 passes) andrealID !== 'FAKE_REPORT_ID'(L4616 passes) → returnstrue→ notification shown.Constant:
CONST.FAKE_REPORT_ID: 'FAKE_REPORT_ID'.Why #95318's QA missed it: the tests in
tests/unit/showReportActionNotificationTest.tsalways passtopmostOneTransactionThreadReportIDasundefined, so theL4616branch is never exercised with a real incoming thread ID + theFAKE_REPORT_IDfallback. A regression test should set up a one-transaction report as topmost (viewer has nochildReportID), an incoming action on the real thread ID with visibility/focus true, and assert no notification fires.Ruled out: wrong topmost report (the expense report's actions are read correctly), wrong incoming reportID (it's the correct real thread ID), and leader/staleness (leader check already passed; ref update is a tick behind at most — secondary).
Confidence: High — deterministic code path, verified end-to-end with
file:lineevidence. Since this is a fresh regression from a just-merged PR,bernhardoj(PR author) may be best placed to fold the fix into a follow-up.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/95711)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
nabi-ebrahimi commentedon Jul 9, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-07-20 09:16:56 UTC.
Proposal
What is the root cause of that problem?
The notification suppression path now depends on a precomputed
topmostOneTransactionThreadReportID:AuthScreensInitHandlerderives it from the focused report and passes it to Pusher callbacks (App/src/libs/Navigation/AppNavigator/AuthScreensInitHandler.tsx
Lines 92 to 99 in 665e743
triggerNotifications()after applying the incoming Onyx update and forwards that cached ID intoshowReportActionNotification()(App/src/libs/actions/User.ts
Lines 674 to 692 in 665e743
App/src/libs/actions/User.ts
Lines 978 to 980 in 665e743
shouldShowReportActionNotification()only suppresses a transaction-thread notification when the incomingreportIDexactly equals that precomputed thread ID (App/src/libs/actions/Report/index.ts
Lines 4601 to 4610 in 665e743
The problem is that the focused report ID used to compute
topmostOneTransactionThreadReportIDcan be incorrect on wide/RHP flows.AuthScreensInitHandlercurrently derives the focused report fromNavigation.getTopmostReportId(), but that helper only reads the report fromREPORTS_SPLIT_NAVIGATOR. When a one-transaction expense report is visible in the RHP/super-wide RHP, the central pane can still hold the parent chat, soNavigation.getTopmostReportId()can return the background chat report ID instead of the expense report ID that the user is actually viewing. This matches the C+ feedback that the report ID is incorrect before reload.The read-only/composer-blocked case after reload looks like a separate permission issue, as discussed in the latest comments. However, the notification bug still applies to the valid expense-in-DM flow, where the user is focused on the related one-transaction report/thread context but the notification suppression still uses the wrong focused report source. Because the global notification path can start from the background split report instead of the visible expense report, it can compute
undefinedor an unrelatedtopmostOneTransactionThreadReportID, so a new message on the related transaction thread is treated as a different report and the browser notification is shown.What changes do you think we should make in order to solve the problem?
First, derive the currently viewed report ID from the visible report context, not only from
Navigation.getTopmostReportId(). When a report is open in the RHP/super-wide RHP, prefer that report ID; otherwise fall back to the currentNavigation.getTopmostReportId()behavior. Then pass this corrected focused report ID intouseOneTransactionThreadReportID().Also update the direct foreground push-notification derivation in
shouldShowPushNotification()to use the corrected currently viewed report ID before derivingtopmostOneTransactionThreadReportID(App/src/libs/Notification/PushNotification/shouldShowPushNotification.ts
Lines 56 to 62 in 665e743
Use the same corrected currently viewed report ID in
shouldShowReportActionNotification()for the direct current-report comparison, so both notification suppression checks use the same source of truth for the report the user is actually focused on.What alternative solutions did you explore? (Optional)
I considered broadening
shouldShowReportActionNotification()to suppress any notification whose report is a child of the current report, but that would incorrectly hide transaction-thread notifications for multi-transaction reports where the thread message is not actually visible in the parent report. The safer fix is to make the “currently viewed report” source of truth use the correct visible report ID for notification suppression.I also considered changing
Navigation.getTopmostReportId()globally, but that helper is used by many unrelated callers that may intentionally want the split-navigator report. Keeping the RHP-first behavior scoped to notification suppression avoids changing broader navigation semantics.Fixed Demo:
Screencast.From.2026-07-10.02-22-09.mp4
David-2002065 commentedon Jul 9, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-07-10 13:12:53 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When User A is focused on a one-transaction expense report and User B sends a message on that report's transaction thread, a notification is shown to User A even though they are actively viewing the report.
What is the root cause of that problem?
shouldShowReportActionNotificationdecides whether the user is currently viewing the relevant report using two "topmost report" values, and both of them resolve throughNavigation.getTopmostReportId():App/src/libs/actions/Report/index.ts
Line 4608 in 884bbe4
App/src/libs/actions/Report/index.ts
Lines 4635 to 4645 in 884bbe4
AuthScreensInitHandlerderivestopmostOneTransactionThreadReportIDfromuseRootNavigationState(Navigation.getTopmostReportId)and hands it to the Pusher callbackApp/src/libs/Navigation/AppNavigator/AuthScreensInitHandler.tsx
Lines 94 to 95 in 884bbe4
getTopmostReportIdcomes fromgetTopmostReportParams, which only ever inspectsSCREENS.REPORTscreens insideREPORTS_SPLIT_NAVIGATOR:App/src/libs/Navigation/helpers/getTopmostReportParams.ts
Lines 19 to 42 in 884bbe4
But a one-transaction expense report is normally not viewed on that screen:
SCREENS.RIGHT_MODAL.EXPENSE_REPORT/SCREENS.RIGHT_MODAL.SEARCH_MONEY_REQUEST_REPORT), while the central pane underneath still holds the parent chat. In this stategetTopmostReportId()keeps returning the parent chat'sreportID— a value that is wrong, not just missing.App/src/components/WideRHPContextProvider/WIDE_RIGHT_MODALS.ts
Lines 8 to 10 in 884bbe4
SCREENS.SEARCH.MONEY_REQUEST_REPORTinsideSEARCH_FULLSCREEN_NAVIGATOR, wheregetTopmostReportId()returnsundefined.In both cases
useOneTransactionThreadReportID(topmostReportID)is fed the wrong report (the parent chat, orundefined), so it returnsundefined, thereportID === topmostOneTransactionThreadReportIDcheck never matches, and the notification fires even though User A is focused on the report. The Airship push path has the same blind spot, since it computestopmostOneTransactionThreadReportIDfromNavigation.getTopmostReportId()too:App/src/libs/Notification/PushNotification/shouldShowPushNotification.ts
Lines 59 to 64 in 884bbe4
This also means the bug is not really a regression of #95318: both before and after that PR, the "which report is the user viewing" resolution only ever looked at the split navigator; viewing the report in the RHP or the Reports tab was simply never covered by this code path.
What changes do you think we should make in order to solve the problem?
Add a
getCurrentlyViewedReportIDhelper inNavigation.tsthat resolves the report in visual stacking order — the RHP first, because an open wide/super-wide RHP renders above the central pane, so checkinggetTopmostReportId()first would short-circuit on the chat underneath it. I deliberately keepgetTopmostReportIditself untouched since it has ~24 call sites with navigation semantics we don't want to change.Navigation.tsalready importsALL_WIDE_RIGHT_MODALS, anduseCurrentReportIDalready sets the precedent of resolving RHP report params separately from the split navigator (getFocusedRouteReportID):App/src/hooks/useCurrentReportID.tsx
Lines 29 to 45 in 884bbe4
Then use it in the three places that drive the notification "am I viewing this report" logic.
In
shouldShowReportActionNotification(also fixes the plain "current report" check for messages sent to the RHP-open report itself):In
AuthScreensInitHandler, so the one-transaction thread lookup receives the expense report the user is actually viewing:In
shouldShowPushNotification, so the native/Airship push path stays in sync:With
topmostReportIDnow resolving to the expense report,useOneTransactionThreadReportIDreturns the transaction thread'sreportID, the one-transaction-thread guard matches the incoming notification, and it is correctly suppressed.What specific scenarios should we cover in automated tests to prevent this bug from reoccurring?
getCurrentlyViewedReportIDwith mocked navigation states: an expense report open in the super-wide RHP over a central-pane chat returns the expense report'sreportID(not the chat's); a wideSEARCH_REPORTRHP returns itsreportID; a focusedSCREENS.SEARCH.MONEY_REQUEST_REPORTin the Search tab returns itsreportID; a plain central-paneSCREENS.REPORTkeeps the existing behavior.shouldShowReportActionNotificationreturnsfalsefor a transaction-thread notification when the associated one-transaction expense report is currently viewed (visible + focused) in each of those navigation contexts.truewhen the same report is not the currently viewed report, or the window is not focused, confirming we didn't over-suppress.What alternative solutions did you explore? (Optional)
getTopmostReportParamsitself to also look at the RHP and search screens, so every consumer ofgetTopmostReportIdtransparently benefits. I ruled this out as the primary approach becausegetTopmostReportIdis consumed by ~24 navigation-related call sites (LHN highlighting, back navigation, unread handling), and broadening its meaning risks subtle regressions elsewhere; scoping the change to the notification path is safer.useOneTransactionThreadReportID'suseOnyxselector (it closes overreport/chatReportwithout passing them as thedependenciesargument, so the cached result can go stale). That is worthwhile hardening for the central-pane flow and could be included in the PR, but it cannot fix this issue on its own: whenever the report is viewed in the RHP or the Reports tab, the hook's inputtopmostReportIDis already the wrong report (the parent chat orundefined), so its output can never be the right thread ID no matter how fresh the selector is.MobileMage commentedon Jul 9, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
trasnake87 commentedon Jul 9, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When User A has a single-expense report open and focused, and User B sends a message in that expense's transaction thread, User A still receives a notification — even though they are already viewing the report whose thread received the message.
What is the root cause of that problem?
This is a regression introduced by #95318 (merged 2026-07-08), which moved the local-notification path off of
Onyx.connect(). Previously,shouldShowReportActionNotificationread the topmost report and its actions from module-levelconnectWithoutViewsubscriptions inReport/index.ts(whereallReportActionswas keyed by barereportID, old line 474) and computedgetOneTransactionThreadReportIDinline with always-fresh data.#95318 replaced that with a new hook whose result is cached in a ref (
AuthScreensInitHandler.tsx:93-99) and handed to the Pusher callback (User.ts:979→shouldShowReportActionNotification). The hook readsreportandchatReportfrom two separateuseOnyxsubscriptions, then consumes them inside theREPORT_ACTIONSselector (src/hooks/useOneTransactionThreadReportID.tsx:10-14):But Onyx memoizes a
useOnyxselector against its own key's data only. Inreact-native-onyx/dist/useOnyx.js:60-78the memoized selector recomputes only whenlastInput !== input(the actions changed) or thedependenciesarray changed. Nodependenciesarray is passed here, so whenreport/chatReportarrive after the selector has cached its result, the cached value goes stale — and becausereportis stillundefinedat that moment,getOneTransactionThreadReportActionearly-returns at thereport?.typeguard (ReportActionsUtils.ts:1898), so the cached value isundefined. The ref then holdsundefined, thereportID === topmostOneTransactionThreadReportIDcheck inReport/index.ts:4616fails, and the notification fires.(The Airship push path in
shouldShowPushNotification.ts:59-64computestopmostOneTransactionThreadReportIDinline fromconnectWithoutViewdata, so it is unaffected — the broken path is the local one that fires when the tab is online and focused.)What changes do you think we should make in order to solve the problem?
Pass the external closure values as the third
dependenciesargument — the exact mechanism Onyx provides for selectors that depend on other keys (useOnyx.js:116-134invalidates the cache and forces a recompute whendependencieschange; signatureuseOnyx(key, options, dependencies?)atuseOnyx.d.ts:25). This matches the existing codebase idiom (usePolicyForTransaction.ts:42,useSelectionModeReportActions.ts:69,usePolicyData/index.ts:47):That single change makes the selector recompute whenever
report,chatReport, or connectivity changes, so the cachedtopmostOneTransactionThreadReportIDalways reflects the report User A is viewing andshouldShowReportActionNotificationcorrectly suppresses the notification.What alternative solutions did you explore? (Optional)
Computing
getOneTransactionThreadReportID(...)viauseMemoover the threeuseOnyxresults instead of a selector. Also correct, but it discards the selector's re-render optimization (the reason #95318 introduced the hook) and re-rendersAuthScreensInitHandleron everyREPORT_ACTIONSupdate. Thedependenciesargument preserves #95318's intent with a one-line, idiomatic fix.samranahm commentedon Jul 9, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
melvin-bot commentedon Jul 9, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann (
External)[-]Notification appears when user is focused on the report[/-][+][$250] Notification appears when user is focused on the report[/+]74 remaining items
DylanDylann commentedon Aug 7, 2026
BugZero 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: I don't think this is a regression from a previous PR. It's an edge case caused by mixing some changes from the navigation refactor and the report view implementation
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:
[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.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/670283
Regression Test Proposal
Test:
Precondition: User A has a one-single expense report
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-66d4-add8-0128-00c2cfb1ff54melvin-bot commentedon Aug 7, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Aug 7, 2026
Payment Summary
Resolving PRs:
fix: Notification appears when user is focused on the report #96891
Reviewer: @DylanDylann owed $250 via NewDot
Reviewer: @nkdengineer owed $250 via NewDot
BugZero Checklist (@mallenexpensify)
melvin-bot commentedon Aug 10, 2026
@mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
mallenexpensify commentedon Aug 11, 2026
Payment Summary
Contributor: @nkdengineer due $250 via NewDot
Contributor+: @DylanDylann due $250 via NewDot
^ Test case created. Thx
twisterdotcom commentedon Aug 18, 2026
$250 approved for @nkdengineer in Report ID: R00d83bEd3e3.
Zapier Logs
Run ID: 00040eee-410e-a2a5-9bf5-ba28da6b07a4SO: https://stackoverflowteams.com/c/expensify/questions/7582
quinthar commentedon Sep 26, 2026
Approved $250 to @DylanDylann