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
What the problem is:
Users are being automatically switched into #focus mode (an unread-only filter) in a way that feels jarring and confusing, causing chats to “disappear” from the Inbox during normal navigation.
What the expected output is:
Reduce accidental/over-eager auto-switching by basing the threshold on the number of reports visible in the user’s LHN (not total reports in Onyx), so fewer users are forced into the mode.
Please re-state the problem that we are trying to solve in this issue.
Users are being automatically switched into #focus mode (GSD / unread-only filter) even when they have very few reports visible in the LHN. This causes chats to "disappear" from the Inbox during normal navigation, creating a jarring and confusing experience. The issue reports a user with only 6 reports in LHN who was still auto-switched.
What is the root cause of that problem?
The auto-switch logic in PriorityModeController counts all reports in Onyx where the user is a participant, owner, or manager — not the reports actually visible in the LHN.
The counting code (line 40-50) iterates over every report in ONYXKEYS.COLLECTION.REPORT and only applies two extremely permissive filters:
isValidReport (ReportUtils.ts:10482-10484) — only checks !!report?.reportID, so any report with an ID passes.
isReportParticipant (ReportUtils.ts:10489-10502) — checks if the user is in participants, ownerAccountID, or managerID.
This count includes expense reports, archived reports, hidden reports, one-transaction thread reports, system chats, and many other report types that are never displayed in the LHN. When this raw count reaches 30 (CONST.REPORT.MAX_COUNT_BEFORE_FOCUS_UPDATE), the user is auto-switched to focus mode.
In contrast, the LHN display uses shouldReportBeInOptionList (ReportUtils.ts) which applies extensive filtering — excluding empty chats, one-transaction threads, inaccessible reports, hidden reports, and more. This creates a large gap between "reports in Onyx" and "reports visible in LHN," causing users with few visible reports to be unexpectedly switched.
What changes do you think we should make in order to solve the problem?
Modify the validReportCount calculation in PriorityModeController (src/components/PriorityModeController.tsx:40-50) to count only reports that would actually appear in the LHN in default mode (non-focus mode), rather than counting all Onyx reports.
The existing LHN filtering logic in shouldReportBeInOptionList (in ReportUtils.ts) already determines whether a report should appear in the LHN. The PriorityModeController should use this same filtering (specifically the default-mode path, not the focus-mode path) when computing its count. This way, the threshold of 30 reports would apply to reports the user can actually see, matching the user's perception of their inbox size.
Key consideration: shouldReportBeInOptionList requires several additional parameters (policies, betas, report actions, etc.). The controller would need to subscribe to these additional Onyx keys, or a helper function could be extracted that provides the necessary LHN-visible count. Performance should be considered since this runs on every report change — but it only needs to run until the threshold check completes (the hasSwitched ref and hasTriedFocusMode NVP prevent re-evaluation after the first switch).
What alternative solutions did you explore? (Optional)
Lowering the threshold constant — Would reduce the number of affected users but doesn't fix the fundamental mismatch. Users with few LHN reports could still be switched.
Adding more exclusion filters to the existing count (e.g., excluding expense reports, archived reports) — Partial fix that would narrow the gap but wouldn't fully align with LHN visibility. Would require ongoing maintenance as new report types are added.
Using getOrderedReportIDs from SidebarUtils — This computes the full ordered list for the LHN, which is more work than needed. Using shouldReportBeInOptionList directly is more targeted and avoids unnecessary sorting.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
Please re-state the problem that we are trying to solve in this issue.
Users with few visible LHN reports get auto-switched to #focus mode because the threshold counts all Onyx reports, not LHN-visible ones.
What is the root cause of that problem?
PriorityModeController counts reports using isValidReport (just checks reportID exists) and isReportParticipant, which includes expense reports, archived reports, one-transaction threads, hidden reports, etc. that never appear in the LHN. The threshold of 30 is reached even when only 6 reports are actually visible. The LHN display path uses shouldReportBeInOptionList which applies much stricter filtering, creating a large gap between counted vs visible reports.
What changes do you think we should make in order to solve the problem?
Replace the isValidReport + isReportParticipant count in PriorityModeController.tsx (lines 40-50) with a count that uses shouldReportBeInOptionList in default mode, so the threshold of MAX_COUNT_BEFORE_FOCUS_UPDATE is checked against reports the user can actually see in the LHN. The controller will need to subscribe to additional Onyx keys (policies, betas, reportActions) that shouldReportBeInOptionList requires, but this is acceptable since the check only runs until the first switch (guarded by hasSwitched ref and hasTriedFocusMode NVP).
⚠️@rishisulakhe Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
Using shouldReportBeInOptionList() directly in PriorityModeController will still overcount reports that are hidden from LHN. Actual LHN visibility adds extra gating in SidebarUtils for hidden reports before calling shouldReportBeInOptionList.
Can we make use of reportsToDisplayInLHN via useSidebarOrderedReports to prevent duplication of the calculation logic?
Can you check and update your proposal if needed ?
Good catch on both points — I've updated the proposal accordingly.
Updated Proposal
Please re-state the problem that we are trying to solve in this issue.
Users are being automatically switched into #focus mode (GSD / unread-only filter) even when they have very few reports visible in the LHN. This causes chats to "disappear" from the Inbox during normal navigation, creating a jarring and confusing experience. The issue reports a user with only 6 reports in LHN who was still auto-switched.
What is the root cause of that problem?
The auto-switch logic in PriorityModeController counts all reports in Onyx where the user is a participant, owner, or manager — not the reports actually visible in the LHN.
The counting code (line 40-50) iterates over every report in ONYXKEYS.COLLECTION.REPORT and only applies two permissive filters: isValidReport (just checks !!report?.reportID) and isReportParticipant (checks participants/ownerAccountID/managerID). This count includes expense reports, archived reports, hidden reports, one-transaction threads, system chats, and many other report types that are never displayed in the LHN.
The actual LHN display pipeline applies multiple additional filtering layers in shouldDisplayReportInLHN — excluding unsupported types, one-transaction threads, and hidden reports — before even reaching shouldReportBeInOptionList. This creates a large gap between "reports in Onyx" and "reports visible in LHN."
What changes do you think we should make in order to solve the problem?
Replace PriorityModeController's custom report counting with the existing LHN report count from the SidebarOrderedReportsContextProvider.
PriorityModeController is already mounted as a child of SidebarOrderedReportsContextProvider inside ComposeProviders in AuthScreens.tsx (provider at line 517, controller at line 745). It can call useSidebarOrderedReportsState() and read orderedReportIDs.length to get the exact count of reports displayed in the LHN — with all filtering layers already applied (hidden reports, unsupported types, one-transaction threads, etc.), without duplicating any logic.
Specific changes in src/components/PriorityModeController.tsx:
Remove the useOnyx(ONYXKEYS.COLLECTION.REPORT) subscription (line 36) and the validReportCountuseMemo (lines 40-50), along with the accountID subscription and isValidReport/isReportParticipant imports (since they're no longer needed).
Addconst {orderedReportIDs} = useSidebarOrderedReportsState(); and use orderedReportIDs.length in place of validReportCount for the threshold comparison at line 73.
Keep the existing isLoadingReportData gate (lines 58-66) — this ensures the controller doesn't evaluate the threshold until reports are fully loaded, even though the context computes reactively from Onyx.
This approach avoids logic duplication, stays in sync with the actual LHN display, and also removes a heavy COLLECTION.REPORT Onyx subscription from PriorityModeController (since the context already manages that subscription).
What alternative solutions did you explore? (Optional)
Using shouldReportBeInOptionList directly — As correctly pointed out by the reviewer, this would still overcount because shouldDisplayReportInLHN in SidebarUtils.ts:248-262 adds extra gating for hidden reports, unsupported types, and one-transaction threads before reaching shouldReportBeInOptionList.
Using shouldDisplayReportInLHN directly — More accurate than option 1, but would duplicate the exact logic already running in SidebarOrderedReportsContextProvider, requiring duplicate Onyx subscriptions and parameters.
Extending the context to expose reportsToDisplayInLHN separately — Unnecessary since orderedReportIDs.length equals the reportsToDisplayInLHN count (sorting doesn't add/remove reports).
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
Activity
MelvinBot commentedon Mar 3, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Users are being automatically switched into
#focusmode (GSD / unread-only filter) even when they have very few reports visible in the LHN. This causes chats to "disappear" from the Inbox during normal navigation, creating a jarring and confusing experience. The issue reports a user with only 6 reports in LHN who was still auto-switched.What is the root cause of that problem?
The auto-switch logic in
PriorityModeControllercounts all reports in Onyx where the user is a participant, owner, or manager — not the reports actually visible in the LHN.The counting code (line 40-50) iterates over every report in
ONYXKEYS.COLLECTION.REPORTand only applies two extremely permissive filters:isValidReport(ReportUtils.ts:10482-10484) — only checks!!report?.reportID, so any report with an ID passes.isReportParticipant(ReportUtils.ts:10489-10502) — checks if the user is inparticipants,ownerAccountID, ormanagerID.This count includes expense reports, archived reports, hidden reports, one-transaction thread reports, system chats, and many other report types that are never displayed in the LHN. When this raw count reaches 30 (
CONST.REPORT.MAX_COUNT_BEFORE_FOCUS_UPDATE), the user is auto-switched to focus mode.In contrast, the LHN display uses
shouldReportBeInOptionList(ReportUtils.ts) which applies extensive filtering — excluding empty chats, one-transaction threads, inaccessible reports, hidden reports, and more. This creates a large gap between "reports in Onyx" and "reports visible in LHN," causing users with few visible reports to be unexpectedly switched.What changes do you think we should make in order to solve the problem?
Modify the
validReportCountcalculation inPriorityModeController(src/components/PriorityModeController.tsx:40-50) to count only reports that would actually appear in the LHN in default mode (non-focus mode), rather than counting all Onyx reports.The existing LHN filtering logic in
shouldReportBeInOptionList(inReportUtils.ts) already determines whether a report should appear in the LHN. ThePriorityModeControllershould use this same filtering (specifically the default-mode path, not the focus-mode path) when computing its count. This way, the threshold of 30 reports would apply to reports the user can actually see, matching the user's perception of their inbox size.Key consideration:
shouldReportBeInOptionListrequires several additional parameters (policies, betas, report actions, etc.). The controller would need to subscribe to these additional Onyx keys, or a helper function could be extracted that provides the necessary LHN-visible count. Performance should be considered since this runs on every report change — but it only needs to run until the threshold check completes (thehasSwitchedref andhasTriedFocusModeNVP prevent re-evaluation after the first switch).What alternative solutions did you explore? (Optional)
getOrderedReportIDsfromSidebarUtils— This computes the full ordered list for the LHN, which is more work than needed. UsingshouldReportBeInOptionListdirectly is more targeted and avoids unnecessary sorting.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.melvin-bot commentedon Mar 3, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ShridharGoel (
External)[-]Reduce forced focus mode switching[/-][+][$250] Reduce forced focus mode switching[/+]melvin-bot commentedon Mar 3, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022028892030546284710
puneetlath commentedon Mar 3, 2026
@ShridharGoel what do you think of Melvin's proposed approach?
openclawdwang-ship-it commentedon Mar 3, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Users with few visible LHN reports get auto-switched to #focus mode because the threshold counts all Onyx reports, not LHN-visible ones.
What is the root cause of that problem?
PriorityModeControllercounts reports usingisValidReport(just checksreportIDexists) andisReportParticipant, which includes expense reports, archived reports, one-transaction threads, hidden reports, etc. that never appear in the LHN. The threshold of 30 is reached even when only 6 reports are actually visible. The LHN display path usesshouldReportBeInOptionListwhich applies much stricter filtering, creating a large gap between counted vs visible reports.What changes do you think we should make in order to solve the problem?
Replace the
isValidReport + isReportParticipantcount inPriorityModeController.tsx(lines 40-50) with a count that usesshouldReportBeInOptionListin default mode, so the threshold ofMAX_COUNT_BEFORE_FOCUS_UPDATEis checked against reports the user can actually see in the LHN. The controller will need to subscribe to additional Onyx keys (policies, betas, reportActions) thatshouldReportBeInOptionListrequires, but this is acceptable since the check only runs until the first switch (guarded byhasSwitchedref andhasTriedFocusModeNVP).rishisulakhe commentedon Mar 3, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
github-actions commentedon Mar 3, 2026
ShridharGoel commentedon Mar 3, 2026
@MelvinBot
Using
shouldReportBeInOptionList()directly inPriorityModeControllerwill still overcount reports that are hidden from LHN. Actual LHN visibility adds extra gating in SidebarUtils for hidden reports before callingshouldReportBeInOptionList.Can we make use of
reportsToDisplayInLHNviauseSidebarOrderedReportsto prevent duplication of the calculation logic?Can you check and update your proposal if needed ?
MelvinBot commentedon Mar 3, 2026
Good catch on both points — I've updated the proposal accordingly.
Updated Proposal
Please re-state the problem that we are trying to solve in this issue.
Users are being automatically switched into
#focusmode (GSD / unread-only filter) even when they have very few reports visible in the LHN. This causes chats to "disappear" from the Inbox during normal navigation, creating a jarring and confusing experience. The issue reports a user with only 6 reports in LHN who was still auto-switched.What is the root cause of that problem?
The auto-switch logic in
PriorityModeControllercounts all reports in Onyx where the user is a participant, owner, or manager — not the reports actually visible in the LHN.The counting code (line 40-50) iterates over every report in
ONYXKEYS.COLLECTION.REPORTand only applies two permissive filters:isValidReport(just checks!!report?.reportID) andisReportParticipant(checks participants/ownerAccountID/managerID). This count includes expense reports, archived reports, hidden reports, one-transaction threads, system chats, and many other report types that are never displayed in the LHN.The actual LHN display pipeline applies multiple additional filtering layers in
shouldDisplayReportInLHN— excluding unsupported types, one-transaction threads, and hidden reports — before even reachingshouldReportBeInOptionList. This creates a large gap between "reports in Onyx" and "reports visible in LHN."What changes do you think we should make in order to solve the problem?
Replace
PriorityModeController's custom report counting with the existing LHN report count from theSidebarOrderedReportsContextProvider.PriorityModeControlleris already mounted as a child ofSidebarOrderedReportsContextProviderinsideComposeProvidersinAuthScreens.tsx(provider at line 517, controller at line 745). It can calluseSidebarOrderedReportsState()and readorderedReportIDs.lengthto get the exact count of reports displayed in the LHN — with all filtering layers already applied (hidden reports, unsupported types, one-transaction threads, etc.), without duplicating any logic.Specific changes in
src/components/PriorityModeController.tsx:useOnyx(ONYXKEYS.COLLECTION.REPORT)subscription (line 36) and thevalidReportCountuseMemo(lines 40-50), along with theaccountIDsubscription andisValidReport/isReportParticipantimports (since they're no longer needed).const {orderedReportIDs} = useSidebarOrderedReportsState();and useorderedReportIDs.lengthin place ofvalidReportCountfor the threshold comparison at line 73.isLoadingReportDatagate (lines 58-66) — this ensures the controller doesn't evaluate the threshold until reports are fully loaded, even though the context computes reactively from Onyx.This approach avoids logic duplication, stays in sync with the actual LHN display, and also removes a heavy
COLLECTION.REPORTOnyx subscription fromPriorityModeController(since the context already manages that subscription).What alternative solutions did you explore? (Optional)
shouldReportBeInOptionListdirectly — As correctly pointed out by the reviewer, this would still overcount becauseshouldDisplayReportInLHNinSidebarUtils.ts:248-262adds extra gating for hidden reports, unsupported types, and one-transaction threads before reachingshouldReportBeInOptionList.shouldDisplayReportInLHNdirectly — More accurate than option 1, but would duplicate the exact logic already running inSidebarOrderedReportsContextProvider, requiring duplicate Onyx subscriptions and parameters.reportsToDisplayInLHNseparately — Unnecessary sinceorderedReportIDs.lengthequals thereportsToDisplayInLHNcount (sorting doesn't add/remove reports).Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.ShridharGoel commentedon Mar 3, 2026
@MelvinBot Implement it
MelvinBot commentedon Mar 3, 2026
🤖 Draft PR created: #84074
Please mark it as "Ready for review" when it is ready for review.
I created this PR from an upstream branch since I don't have push access to your fork.
To take ownership of this branch and be able to push updates, run:
Then you can close this PR and open a new one from your fork.
ShridharGoel commentedon Mar 20, 2026
@mallenexpensify This is due for payment
mallenexpensify commentedon Mar 21, 2026
Payment Summary
Contributor+: @ShridharGoel due $250 via NewDot
Thx
JmillsExpensify commentedon Apr 6, 2026
$250 approved for @ShridharGoel