Skip to content

[Due for payment 2026-07-29] [$250] Anon user can't reach public room #92672

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.3.99-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: #91931
Email or phone of affected tester (no customers): -
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Xiaomi RedMi Note 10 / Android 12
App Component: Other

Action Performed:

Precondition: log out from application.

  1. Navigate to this link - https://staging.new.expensify.com/r/1540486774487195 as anon user
  2. Open Inbox > tap on public room
  3. Click on any thread on the public room
    .

Expected Result:

  1. User see public room in Inbox

Actual Result:

Woohoo! All caught up. screen

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7171415_1780567780198.Screenrecorder-2026-06-04-12-47-58-630.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Svetlana Lazutkina
Bug ID: 7171415

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @brunovjk

Activity

  1. applause-bot commented on Jun 4, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/5a47c57779cedad9db830ec8ab628ec2a05004cd9298d0e571bc8ac714d20206

  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 4, 2026
  3. MelvinBot commented on Jun 4, 2026

    @MelvinBot
    Contributor

    Proposal

    Confidence: Medium — the failing LHN filter chain is identified with code evidence, but the precise trigger (thread data missing vs. parent lookup failing) needs one runtime Onyx check to confirm. Details below.

    What is the root cause of that problem?

    When an anonymous user opens a thread inside a public room, the LHN goes empty because the sidebar's filter drops both reports it could show:

    1. The thread itself is only kept if it's present in Onyx. The sidebar iterates the report_* Onyx collection, and a report is force-kept only when report.reportID === currentReportId (ReportUtils.ts:9579-9581). For an anonymous user the freshly-opened thread report often isn't (yet) populated in Onyx, so it is never iterated and never added.

    2. The parent public room is then removed by the empty-chat filter (ReportUtils.ts:9711-9723). That filter keeps the room only when canHideReport is false, and canHideReport comes from shouldHideReport, which keeps the room only if it is the parent of the currently-viewed report: parentReport?.reportID !== report?.reportID. That check relies on getParentReport(currentReport) resolving the room — which fails when the focused thread isn't in Onyx (getParentReport(undefined) → undefined), so the room is hidden too.

    Net result: 0 items in the list → SidebarLinks.tsx:88 renders the "Woohoo! All caught up." empty state.

    This is not caused by the recently merged #91931 (fix for #90536). That PR's new code only runs on the anon→signed-in transition or writes an Onyx key read nowhere in the LHN path. In fact it's the same broken intermediate state — an anon user sitting on a public-room thread with no public room in the LHN — that #91931's joinPublicRoomIfNeeded band-aids after sign-in. QA caught the before-sign-in version of it, which is this issue.

    Evidence chain (file:line)

    One runtime check to confirm root cause (anon session, inspect Onyx at the empty-LHN moment): is report_<threadID> present and does it carry parentReportID? If absent, the trigger is "thread not loaded for anon users" (the openReport(threadID) response is the thing to verify) rather than a pure filter bug. This distinction decides whether the real fix is client-side (keep the parent room visible) or backend (return thread data to anon users).

    What changes do you think we should make in order to solve the problem?

    Keep the parent public room visible in the LHN while an anonymous user is viewing one of its threads, instead of depending on the thread being fully loaded in Onyx. Practically, make shouldHideReport resilient when the currently-viewed report is a thread of a public room — the public room should not be hidden just because getParentReport(currentReport) momentarily returns undefined. Confirm with the runtime Onyx check above first; if it shows the thread report never loads for anon users at all, the fix belongs in the openReport / data-loading path (and may require a backend change to return thread data for anonymous users — which would be outside this repo).

    What alternative solutions did you explore? (Optional)

    Have ReportFetchHandler track the parent room when an anon user opens a thread by handling the thread case in ReportFetchHandler.tsx:272-278 (it currently bails on isPublicRoom(thread) === false). This fixes the related post-sign-in flow but does not by itself repopulate the live LHN, so it's complementary rather than a full fix.

    Related issues


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/92672) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  4. abbasifaizan70 commented on Jun 4, 2026

    @abbasifaizan70
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When an anonymous (logged-out) user opens a public room via a deep link and then opens a thread inside it, the public room is expected to appear in the Inbox (LHN). Instead the Inbox shows the empty "Woohoo! All caught up" state and the public room is missing (reproduced on Android).

    What is the root cause of that problem?

    Before a report reaches the option-list check, the LHN drops it if it is hidden for the current user and nothing overrides that. The override list (shouldOverrideHidden) only covers drafts, errors, the focused report, system chat, pinned, attention, and own policy expense chat — there is no exemption for public rooms.

    // Check if report should override hidden status
    const requiresAttention = reportAttributes?.[report?.reportID]?.requiresAttention;
    const isSystemChat = isSystemChatUtil(report);
    const shouldOverrideHidden =
    !!draftComment ||
    hasErrorsOtherThanFailedReceipt ||
    isFocused ||
    isSystemChat ||
    !!report.isPinned ||
    // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
    requiresAttention ||
    (report.isOwnPolicyExpenseChat && !isReportArchived);
    if (isHidden && !shouldOverrideHidden) {
    return {shouldDisplay: false};
    }

    An anonymous user is not a participant of the public room, so the report has no notification preference for them. isHiddenForCurrentUser returns true whenever the preference is undefined/null/'', so the public room is treated as hidden. Combined with the missing override, the room is filtered out of the LHN once it is not the focused report (e.g. after opening a thread), producing the empty Inbox.

    App/src/libs/ReportUtils.ts

    Lines 2241 to 2250 in 21afc57

    function isHiddenForCurrentUser(reportOrPreference: OnyxEntry<Report> | string | null | undefined): boolean {
    if (typeof reportOrPreference === 'object' && reportOrPreference !== null) {
    const notificationPreference = getReportNotificationPreference(reportOrPreference);
    return isHiddenForCurrentUser(notificationPreference);
    }
    if (reportOrPreference === undefined || reportOrPreference === null || reportOrPreference === '') {
    return true;
    }
    return reportOrPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN;
    }

    What changes do you think we should make in order to solve the problem?

    Exempt public rooms viewed by an anonymous user from the hidden filter, so they remain visible in the LHN even without a notification preference. This adds one condition to shouldOverrideHidden (importing isPublicRoom from ./ReportUtils and isAnonymousUser from ./actions/Session).

    const shouldOverrideHidden =
    !!draftComment ||
    hasErrorsOtherThanFailedReceipt ||
    isFocused ||
    isSystemChat ||
    !!report.isPinned ||
    // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
    requiresAttention ||
    (report.isOwnPolicyExpenseChat && !isReportArchived);

    const shouldOverrideHidden =
        !!draftComment ||
        hasErrorsOtherThanFailedReceipt ||
        isFocused ||
        isSystemChat ||
        !!report.isPinned ||
        // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
        requiresAttention ||
        (report.isOwnPolicyExpenseChat && !isReportArchived) ||
        (isPublicRoom(report) && isAnonymousUser());

    What alternative solutions did you explore? (Optional)

    Exempt public rooms regardless of session type by adding || isPublicRoom(report) to shouldOverrideHidden. This is simpler and avoids the isAnonymousUser dependency, but it widens the change to logged-in users as well, so a public room a signed-in user has hidden would also resurface in the LHN — broader than the reported scenario and riskier.

    const shouldOverrideHidden =
    !!draftComment ||
    hasErrorsOtherThanFailedReceipt ||
    isFocused ||
    isSystemChat ||
    !!report.isPinned ||
    // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
    requiresAttention ||
    (report.isOwnPolicyExpenseChat && !isReportArchived);

        (report.isOwnPolicyExpenseChat && !isReportArchived) ||
        isPublicRoom(report);
  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jun 4, 2026
  6. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jun 4, 2026
  7. kamronbek04 commented on Jun 4, 2026

    @kamronbek04
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    An anonymous (logged-out) user opens a public room via a deep link, then taps into the Inbox. Instead of seeing the public room they're viewing, the Inbox shows the "Woohoo! All caught up." empty state. The same thing happens after drilling into a thread of that room — the public room disappears from the LHN entirely, so the user has no way back to it from the Inbox.

    What is the root cause of that problem?

    An anonymous user is never a participant of the public room they land on, so the room's notification preference is HIDDEN. That single fact is what makes it drop out of the LHN.

    The LHN inclusion logic in SidebarUtils.shouldDisplayReportInLHN computes isHidden from the notification preference and then bails unless an explicit override applies:

    https://github.com/Expensify/App/blob/main/src/libs/SidebarUtils.ts#L318-L333

    const shouldOverrideHidden =
        !!draftComment ||
        hasErrorsOtherThanFailedReceipt ||
        isFocused ||
        isSystemChat ||
        !!report.isPinned ||
        requiresAttention ||
        (report.isOwnPolicyExpenseChat && !isReportArchived);
    
    if (isHidden && !shouldOverrideHidden) {
        return {shouldDisplay: false};
    }

    For an anonymous viewer of a public room, the only override that ever fires is isFocused (report.reportID === currentReportId). The same IS_FOCUSED carve-out is the first thing checked in reasonForReportToBeInOptionList:

    https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L9514-L9519

    So the room is visible only while it is the open report. The moment the anonymous user navigates to the Inbox (narrow layout — Android app — means no report is focused) or opens a thread (now the thread is focused, not the room), isFocused is false for the room, none of the other overrides apply, isHidden wins, and the room is filtered out. With nothing else in an anonymous session's LHN, the list collapses to "All caught up." A signed-in user never hits this because opening/joining the room sets a non-hidden notification preference.

    This is also why it surfaced during QA of #91931: that PR fixed the post-login variant by recording the room the anonymous user is on in VIEWING_PUBLIC_ROOM_REPORT_ID and re-opening it after sign-in. But the still-anonymous path was never wired into the LHN — the tracked report ID isn't consulted when deciding what to show, so the room is hidden as soon as it loses focus.

    What changes do you think we should make in order to solve the problem?

    Reuse the VIEWING_PUBLIC_ROOM_REPORT_ID that #91931 already maintains, and treat "the public room this anonymous user is currently viewing" the same way the code treats the focused report — keep it in the LHN even when something else is focused. That key is only ever written for anonymous users (the effect that sets it is gated on isAnonymousUser), so matching against it is inherently anon-scoped and won't affect signed-in users.

    The room has to clear both gates, so the change is in two spots. First, the hidden override in shouldDisplayReportInLHN:

         const shouldOverrideHidden =
             !!draftComment ||
             hasErrorsOtherThanFailedReceipt ||
             isFocused ||
    +        report.reportID === viewingPublicRoomReportID ||
             isSystemChat ||
             !!report.isPinned ||
             // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
             requiresAttention ||
             (report.isOwnPolicyExpenseChat && !isReportArchived);

    Second, mirror the IS_FOCUSED short-circuit in reasonForReportToBeInOptionList so the room isn't dropped later by the excludeEmptyChats / canHideReport checks:

         if (report?.reportID === currentReportId) {
             return CONST.REPORT_IN_LHN_REASONS.IS_FOCUSED;
         }
    +    // Keep the public room an anonymous user is currently viewing in the LHN even after
    +    // they open one of its threads or navigate to the Inbox (where nothing is focused).
    +    if (!!viewingPublicRoomReportID && report?.reportID === viewingPublicRoomReportID) {
    +        return CONST.REPORT_IN_LHN_REASONS.DEFAULT;
    +    }

    The supporting plumbing is mechanical: thread viewingPublicRoomReportID through ShouldDisplayReportInLHNParams and ShouldReportBeInOptionListParams, forward it from getReportsToDisplayInLHN / updateReportsToDisplayInLHN, and read it once in useSidebarOrderedReports via useOnyx(ONYXKEYS.VIEWING_PUBLIC_ROOM_REPORT_ID) before passing it into both SidebarUtils calls.

    One thing to watch: #91931 sets VIEWING_PUBLIC_ROOM_REPORT_ID but never clears it. With this change the tracked room now stays pinned in the LHN, so it should be reset when it's no longer relevant — clear it on sign-in completion and when the anonymous ReportFetchHandler unmounts — otherwise a stale public room could linger after the user moves on. Scope boundary: the override only matches a report whose ID equals an anon-only Onyx value, so signed-in LHNs, search results, and every other report are untouched. Test: as an anonymous user, open a public room deep link, then open the Inbox → the room is listed (not "All caught up"); open one of its threads, return to the Inbox → the room is still listed.

    What alternative solutions did you explore? (Optional)

    Setting a non-hidden notification preference on the room when an anonymous user opens it, so it survives the isHidden gate the normal way. Rejected: notification preference is a participant-level setting synced to the back end, and an anonymous viewer isn't a member — writing one fakes membership state, risks being pushed to the server, and would have to be torn down on sign-in. Gating LHN visibility on the existing "currently viewing" signal is local, reversible, and already half-built by #91931. I also considered widening the isFocused definition itself to include the parent room while a thread is focused, but isFocused is used well beyond the hidden override (highlighting, sorting, the option-list reason), and overloading it would leak "this room is selected" semantics into places that genuinely mean the active report.

  8. yusufdeveloper2903 commented on Jun 4, 2026

    @yusufdeveloper2903
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When an anonymous user opens a public room and then taps into a thread inside that room, the public room disappears from the Inbox/LHN and the "Woohoo! All caught up" empty state is shown, so the anon user can no longer get back to the public room.

    What is the root cause of that problem?

    The LHN filters every report through shouldDisplayReportInLHN in SidebarUtils. For a report whose notification preference is hidden, that function only keeps it in the list when one of the shouldOverrideHidden conditions is true — and the only relevant one here is isFocused (i.e. the report is the one currently being viewed):

    const shouldOverrideHidden =
    !!draftComment ||
    hasErrorsOtherThanFailedReceipt ||
    isFocused ||
    isSystemChat ||
    !!report.isPinned ||
    // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
    requiresAttention ||
    (report.isOwnPolicyExpenseChat && !isReportArchived);
    if (isHidden && !shouldOverrideHidden) {
    return {shouldDisplay: false};
    }

    For an anonymous user, a public room is always hidden. The user isn't a real participant, so getReportNotificationPreference falls back to HIDDEN:

    App/src/libs/ReportUtils.ts

    Lines 1897 to 1903 in 753ada2

    function getReportNotificationPreference(report: OnyxEntry<Report>): ValueOf<typeof CONST.REPORT.NOTIFICATION_PREFERENCE> {
    const participant = deprecatedCurrentUserAccountID ? report?.participants?.[deprecatedCurrentUserAccountID] : undefined;
    // Empty notification preference should return `hidden`
    // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
    return participant?.notificationPreference || CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN;
    }

    and isHiddenForCurrentUser therefore returns true:

    App/src/libs/ReportUtils.ts

    Lines 2241 to 2250 in 753ada2

    function isHiddenForCurrentUser(reportOrPreference: OnyxEntry<Report> | string | null | undefined): boolean {
    if (typeof reportOrPreference === 'object' && reportOrPreference !== null) {
    const notificationPreference = getReportNotificationPreference(reportOrPreference);
    return isHiddenForCurrentUser(notificationPreference);
    }
    if (reportOrPreference === undefined || reportOrPreference === null || reportOrPreference === '') {
    return true;
    }
    return reportOrPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN;
    }

    So the room only survives the LHN filter while it is the focused report (reasonForReportToBeInOptionList short-circuits to IS_FOCUSED for report.reportID === currentReportId):

    App/src/libs/ReportUtils.ts

    Lines 9579 to 9581 in 753ada2

    if (report?.reportID === currentReportId) {
    return CONST.REPORT_IN_LHN_REASONS.IS_FOCUSED;
    }

    The moment the anon user opens a thread inside the room, currentReportId becomes the thread, the public room is no longer focused, isHidden && !shouldOverrideHidden is now true, and shouldDisplayReportInLHN returns {shouldDisplay: false} — dropping the room from the Inbox. The thread itself is also hidden for the same reason once it loses focus, which is why the Inbox collapses all the way to "All caught up".

    Note this is not fixed by #91931 (the PR this was caught under). That PR stores VIEWING_PUBLIC_ROOM_REPORT_ID and re-openReports the room, but only after sign-in — its effect is gated on the anonymous → signed-in transition (ReportFetchHandler L272-L278). While the user stays anonymous, nothing keeps the room in the LHN.

    What changes do you think we should make in order to solve the problem?

    An anonymous session can only ever access public rooms, so a public room should not be hidden from an anon user's LHN just because it isn't the focused report. I'd add that as an override in shouldDisplayReportInLHN:

         const shouldOverrideHidden =
             !!draftComment ||
             hasErrorsOtherThanFailedReceipt ||
             isFocused ||
    +        // An anonymous user can only access public rooms, and such a room's notification preference
    +        // defaults to `hidden`. Without this, opening a thread inside the room (which steals focus)
    +        // drops the room from the LHN, leaving the anon user unable to return to it. See #92672.
    +        (isPublicRoom(report) && isAnonymousUser()) ||
             isSystemChat ||
             !!report.isPinned ||
             // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
             requiresAttention ||
             (report.isOwnPolicyExpenseChat && !isReportArchived);

    Supporting change: import isPublicRoom from ./ReportUtils and isAnonymousUser from ./actions/Session in SidebarUtils.ts.

    This pairs isPublicRoom with isAnonymousUser() exactly the way ReportUtils already gates anon-only public-room behaviour elsewhere, e.g. in canLeaveChat:

    App/src/libs/ReportUtils.ts

    Lines 11313 to 11315 in 753ada2

    if (isPublicRoom(report) && isAnonymousUserSession()) {
    return false;
    }

    Once this override is in place, the non-focused public room still passes the rest of reasonForReportToBeInOptionList (it has a reportName/type, is a chat room, is accessible to anon, and already has its CREATED + message actions loaded, so it isn't excluded as empty), so it renders normally in the Inbox.

    Edge cases:

    • Offline: purely a client-side display predicate, so it works the same offline.
    • After sign-in: isAnonymousUser() becomes false, the override no longer applies, and Public room not display in LHN after anon user login from a thread of public room #91931 already re-fetches the room with a real notification preference — so there's no regression and no double-handling.
    • Platforms: the LHN filter is shared, so the fix covers all platforms (the report is from Android App, but the same path runs everywhere a thread can steal focus from the room).

    What alternative solutions did you explore? (Optional)

    • Plumb VIEWING_PUBLIC_ROOM_REPORT_ID (from Public room not display in LHN after anon user login from a thread of public room #91931) into SidebarUtils and override hidden only for that exact room. Rejected: it threads an Onyx value through getReportsToDisplayInLHN → updateReportsToDisplayInLHN → shouldDisplayReportInLHN for no real gain — in an anon session the only rooms in Onyx are public rooms anyway, so the broader isPublicRoom && isAnonymousUser check is simpler and just as safe.
    • Give the anon user's public room a non-hidden notification preference. Rejected: that mutates report/Onyx data and would ripple into unread/GBR, leave-room and other notification-driven logic — far more side effects than a display-only fix.
    • Treat the parent public room as "focused" whenever the current report is its thread. Rejected: currentReportId is a single value consumed across the whole option-list pipeline; overloading it is regression-prone compared to a targeted override.
  9. mukhrr commented on Jun 4, 2026

    @mukhrr
    Contributor

    Proposal

    What is the root cause of that problem?

    This is Android native specific. In the Android app, after an anonymous user opens a public room from /r/1540486774487195, then taps Inbox, the active route becomes the Inbox/sidebar route instead of the report route. That makes the route-derived currentReportID stop pointing at the public room.

    The related history is PR #91931, which fixed a similar anonymous public-room/thread case. That PR added ONYXKEYS.VIEWING_PUBLIC_ROOM_REPORT_ID to remember the public room being viewed:
    https://github.com/Expensify/App/pull/91931/files#diff-5c9f08c7c2b10f6bba8a1eaa36d36e98c0e40c280f9158871296c4be2ffbd878R432-R435

    It also updates that key from ReportFetchHandler when an anonymous user is focused on a public room:

    useEffect(() => {
    if (!isFocused || !reportID || !isPublicRoom(report) || !isAnonymousUser) {
    return;
    }
    setViewingPublicRoomReportID(isThread(report) ? report.parentReportID : reportID);
    }, [reportID, report, isAnonymousUser, isFocused]);

    But that remembered public-room ID is only used for the anonymous-to-signed-in refetch case. The LHN/sidebar still derives its active report only from navigation state:

    const {currentReportID: currentReportIDValue} = useCurrentReportIDState();
    const derivedCurrentReportID = currentReportIDForTests ?? currentReportIDValue;

    That navigation state comes from Navigation.getTopmostReportId(state):

    const updateCurrentReportID = useCallback(
    (state: NavigationState) => {
    /*
    * Make sure we don't make the reportID undefined when switching between the chat list and settings tab.
    * This helps prevent unnecessary re-renders.
    */
    const params = state?.routes?.[state.index]?.params;
    if (params && 'screen' in params && typeof params.screen === 'string' && params.screen.indexOf('Settings_') !== -1) {
    return;
    }
    const reportID = Navigation.getTopmostReportId(state);

    Then useSidebarOrderedReports passes that route-derived ID into the LHN filter:

    let reportsToDisplay = {};
    if (shouldDoIncrementalUpdate) {
    reportsToDisplay = SidebarUtils.updateReportsToDisplayInLHN({
    displayedReports: currentReportsToDisplay,
    reports: chatReports,
    updatedReportsKeys: effectiveUpdatedReports,
    currentReportId: derivedCurrentReportID,
    isInFocusMode: priorityMode === CONST.PRIORITY_MODE.GSD,
    betas,
    transactionViolations,
    reportNameValuePairs,
    reportAttributes,
    draftComments: reportsDrafts,
    transactions,
    isOffline,
    currentUserLogin: currentUserLogin ?? '',
    currentUserAccountID: accountID,
    });
    } else {
    Log.info('[useSidebarOrderedReports] building reportsToDisplay from scratch');
    reportsToDisplay = SidebarUtils.getReportsToDisplayInLHN({
    currentReportId: derivedCurrentReportID,
    reports: chatReports,

    The report-list filter only guarantees inclusion for the currently viewed report:

    App/src/libs/ReportUtils.ts

    Lines 9576 to 9580 in 22fb956

    // Include the currently viewed report. If we excluded the currently viewed report, then there
    // would be no way to highlight it in the options list and it would be confusing to users because they lose
    // a sense of context.
    if (report?.reportID === currentReportId) {
    return CONST.REPORT_IN_LHN_REASONS.IS_FOCUSED;

    So on Android native, tapping Inbox makes the public room no longer look “focused” to the LHN, even though VIEWING_PUBLIC_ROOM_REPORT_ID still knows which anonymous public room should stay visible. Since this anonymous public room can otherwise look like an empty/non-joined room, it gets filtered out and the Inbox shows the empty “Woohoo! All caught up.” state.

    What changes do you think we should make in order to solve the problem?

    In useSidebarOrderedReports, use VIEWING_PUBLIC_ROOM_REPORT_ID as the effective current report only for anonymous users.

    Small diff sketch:

    +import useIsAnonymousUser from './useIsAnonymousUser';
    
     function SidebarOrderedReportsContextProvider(...) {
    +    const isAnonymousUser = useIsAnonymousUser();
    +    const [viewingPublicRoomReportID] = useOnyx(ONYXKEYS.VIEWING_PUBLIC_ROOM_REPORT_ID);
         const {currentReportID: currentReportIDValue} = useCurrentReportIDState();
    -    const derivedCurrentReportID = currentReportIDForTests ?? currentReportIDValue;
    +    const derivedCurrentReportID =
    +        currentReportIDForTests ??
    +        (isAnonymousUser && viewingPublicRoomReportID ? viewingPublicRoomReportID : currentReportIDValue);

    Also include isAnonymousUser and viewingPublicRoomReportID in the relevant memo/callback dependency lists.

    This keeps the fix scoped to anonymous public-room browsing. Authenticated users and normal Inbox behavior continue using the route-derived current report.

    Add a regression test in tests/unit/useSidebarOrderedReportsTest.tsx:

    +await Onyx.set(ONYXKEYS.VIEWING_PUBLIC_ROOM_REPORT_ID, '1540486774487195');
    +currentReportIDForTestsValue = undefined;
    +
    +renderHook(() => useSidebarOrderedReports(), {wrapper: TestWrapper});
    +
    +expect(mockSidebarUtils.getReportsToDisplayInLHN).toHaveBeenCalledWith(
    +    expect.objectContaining({
    +        currentReportId: '1540486774487195',
    +    }),
    +);

    QA should explicitly cover Android native:

    1. Log out on Android app.
    2. Open https://staging.new.expensify.com/r/1540486774487195.
    3. Open Inbox.
    4. Verify the public room is shown in Inbox instead of “Woohoo! All caught up.”

    What alternative solutions did you explore? (Optional)

    We could make all public rooms bypass the LHN filters, but that is too broad and could show unrelated public rooms. Using VIEWING_PUBLIC_ROOM_REPORT_ID is narrower because it only preserves the anonymous public room the user actually opened.

  10. melvin-bot commented on Jun 4, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @brunovjk (External)

  11. David-2002065 commented on Jun 4, 2026

    @David-2002065
    Contributor

    Proposal

    What is the root cause of that problem?

    The new effect added by PR #91931 is supposed to remember the public room an anonymous user is viewing (or whose thread they are viewing) in VIEWING_PUBLIC_ROOM_REPORT_ID, but its guard never lets the thread case through.

    useEffect(() => {
        if (!isFocused || !reportID || !isPublicRoom(report) || !isAnonymousUser) {
            return;
        }
        setViewingPublicRoomReportID(isThread(report) ? report.parentReportID : reportID);
    }, [reportID, report, isAnonymousUser, isFocused]);

    https://github.com/Expensify/App/blob/main/src/pages/inbox/ReportFetchHandler.tsx#L272-L278

    isPublicRoom reads report?.visibility, and thread reports don't carry their own visibility — they inherit it from the parent room:

    function isPublicRoom(report: OnyxEntry<Report>): boolean {
        return report?.visibility === CONST.REPORT.VISIBILITY.PUBLIC || report?.visibility === CONST.REPORT.VISIBILITY.PUBLIC_ANNOUNCE;
    }

    https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L1793-L1795

    So whenever an anonymous user is viewing a thread of a public room, isPublicRoom(report) is false, the effect bails out, and the isThread(report) ? report.parentReportID : reportID branch the author wrote is dead code. The Onyx key only ever gets set when the route happens to be the public room itself; the moment the anonymous user steps into a thread the public room context is no longer being tracked.

    That is exactly the QA flow:

    1. Anon lands on /r/1540486774487195 (the public room) → effect runs with the public room as report, VIEWING_PUBLIC_ROOM_REPORT_ID is set ✓
    2. Anon taps Inbox → public room is visible in LHN ✓
    3. Anon clicks a thread inside the public room → report is now the thread, isPublicRoom(thread) returns false, effect bails, and any later use of VIEWING_PUBLIC_ROOM_REPORT_ID (most importantly the joinPublicRoomIfNeeded re-fetch after the user signs in https://github.com/Expensify/App/blob/main/src/pages/inbox/ReportFetchHandler.tsx#L188-L194 called from https://github.com/Expensify/App/blob/main/src/pages/inbox/ReportFetchHandler.tsx#L239-L247) can no longer reach the public room → the LHN ends up on the "Woohoo! All caught up." empty state.

    This is also why the same QA scenario didn't reproduce in the PR's original test plan: the PR demo started on the public room first, which let step 1 prime the Onyx key. Land on a thread URL directly (or do any state transition that re-runs this effect while on a thread) and the tracking is silently lost.

    What changes do you think we should make in order to solve the problem?

    I'd subscribe to the parent report and treat "thread of a public room" as a public-room context for the purposes of this effect. The ternary already encodes the intent — we just need to let that branch run.

    - const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportOnyx?.chatReportID}`);
    + const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportOnyx?.chatReportID}`);
    + const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportOnyx?.parentReportID}`);
      useEffect(() => {
    -     if (!isFocused || !reportID || !isPublicRoom(report) || !isAnonymousUser) {
    -         return;
    -     }
    -     setViewingPublicRoomReportID(isThread(report) ? report.parentReportID : reportID);
    - }, [reportID, report, isAnonymousUser, isFocused]);
    +     if (!isFocused || !reportID || !isAnonymousUser) {
    +         return;
    +     }
    +     const isThreadOfPublicRoom = isThread(report) && isPublicRoom(parentReport);
    +     if (!isPublicRoom(report) && !isThreadOfPublicRoom) {
    +         return;
    +     }
    +     setViewingPublicRoomReportID(isThreadOfPublicRoom ? report.parentReportID : reportID);
    + }, [reportID, report, parentReport, isAnonymousUser, isFocused]);

    Concretely:

    1. Subscribe to parentReport via parentReportID (mirroring how chatReport is already subscribed in this file).
    2. Compute isThreadOfPublicRoom from isThread(report) && isPublicRoom(parentReport) so we use the parent's visibility, not the (always-empty) thread visibility.
    3. Allow the effect to write when either the report itself is a public room, or it's a thread of one — keeping the existing ternary behavior (parent ID for the thread case, reportID otherwise).

    I'd also add a regression test that mounts ReportFetchHandler with an anonymous session and a thread whose parentReportID points at a public room, and asserts VIEWING_PUBLIC_ROOM_REPORT_ID ends up equal to the parent's reportID.

    What alternative solutions did you explore? (Optional)

    • Teach isPublicRoom itself to walk the parent chain (e.g. isPublicRoom(report) || (isThread(report) && parent?.visibility === PUBLIC...)). Strongest competing fix: it removes the bug everywhere isPublicRoom is used today, including unrelated call sites like ReportFooter.tsx#L75 and canLeaveChat in ReportUtils.ts#L11280. Rejected because those existing call sites intentionally distinguish "the room itself" from "a thread inside it" — ReportFooter's anonymous-composer optimistic state and canLeaveChat's "anon can't leave a public room" guard would silently change meaning. Containing the parent-aware check inside the single effect that actually needs it keeps blast radius zero.
    • Call joinPublicRoomIfNeeded/openReport(publicRoomID) directly from the thread-open path instead of relying on the Onyx key, eagerly re-hydrating the public room whenever an anonymous user lands on a thread. Rejected because it duplicates fetching with the existing fetchReport() flow and would refetch the public room on every focus change rather than only on the sign-in transition; it also wouldn't fix the dead isThread(report) ? report.parentReportID : reportID branch, which is a real bug regardless.
    • Set VIEWING_PUBLIC_ROOM_REPORT_ID from the link-handling layer (e.g. when Link.openLink resolves a public-room report ID for an anonymous user) so the Onyx key is primed without depending on a React effect at all. Rejected because the focused-screen effect is the cheapest source of truth for "which public room is this anon session looking at right now" — moving it upstream means re-implementing focus tracking and dealing with route changes that don't go through Link.openLink (e.g. in-app Navigation.navigate from a parent room into a child thread).
  12. changed the title [-]Anon user can't reach public room[/-] [+][$250] Anon user can't reach public room[/+] on Jun 4, 2026
  13. 74 remaining items

  14. mallenexpensify commented on Jul 30, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @yusufdeveloper2903 paid $250 via Upwork
    Contributor+: @brunovjk due $250 via NewDot

    @yusufdeveloper2903 can you please accept the job below? Please reply here and tag me once you have.
    If you're not sent an offer in Upwork when you're assigned to an issue, please tag me. If an Upwork job exists, please submit a proposal.
    https://www.upwork.com/jobs/~022082920102476221973

    ^ Test case created. Thx

  15. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Jul 30, 2026
  16. melvin-bot commented on Jul 30, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  17. yusufdeveloper2903 commented on Jul 31, 2026

    @yusufdeveloper2903
    Contributor

    @mallenexpensify Thanks! I've accepted the job offer on Upwork

  18. laurenreidexpensify commented on Jul 31, 2026

    @laurenreidexpensify
    Contributor

    $250 approved for @brunovjk

  19. yusufdeveloper2903 commented on Aug 3, 2026

    @yusufdeveloper2903
    Contributor

    @mallenexpensify friendly bump 🙂

  20. mallenexpensify commented on Aug 4, 2026

    @mallenexpensify
    Contributor

    @yusufdeveloper2903 paid, summary updated above. Thx.

  21. mkhutornyi commented on Sep 6, 2026

    @mkhutornyi
    Contributor

    The PR fixing this issue caused regression: Email - User is logged in and not redirected to User created room as the new user.
    Especially, the culprit is the guard which was added in 4839c55 ("fix: keep public room in LHN for anonymous users on cold start").

    More details: #99156 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions