Skip to content

[Due for payment 2026-11-16] [$175] Chat - "Latest messages" pill remains visible after sending a message #106015

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: v9.5.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: #104242
Email or phone of affected tester (no customers): n/a
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5.1 Safrai, iPhone 13 iOS 26.6
App Component: Chat Report View

Action Performed:

  1. Go to https://staging.new.expensify.com
  2. Open a chat from a deep link to an old message
  3. Send a message. Verify the list jumps to the newest messages and your message is visible.

Expected Result:

The "Latest messages" pill should disappear after sending a message and the chat jumps to the newest messages.

Actual Result:

"Latest messages" pill remains visible after sending a message and jumping to the newest messages

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7305231_1793828364964.Recording__3330.mp4

View all open jobs on GitHub

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

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

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 4, 2026
  2. applause-bot commented on Nov 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/856c26d65da95854a9a909090893790e861bbb6206a51b00fe02424d2612f4c1

  3. MelvinBot commented on Nov 4, 2026

    @MelvinBot
    Contributor

    🤖 Web test steps verification results: ⚠️ partial

    The handed-over dev NewDot web session was accessible. Missing historical-message fixtures blocked reproduction of issue 106015.

    Concierge history containing only its welcome message

    Step Status
    1. Open the app in the handed-over sessionAuthenticated Home and Inbox rendered.
    ✅
    2. Open an old-message deep link with newer messages offscreenFixture blocked: available Concierge history contained only its welcome message, without an eligible old-message link and newer-message history.
    Concierge history containing only its welcome message
    ❌
    3. Send and verify newest messages and the sent message become visibleNot executed: blocked by the missing historical-message fixture.
    ❌
    4. Verify Latest messages disappears after the jumpNot executed: the required send-triggered jump could not be tested. The pill's presence alone does not reproduce the issue.
    ❌

    view run

  4. MelvinBot commented on Nov 4, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    Likely stale scroll tracking after the jump; medium confidence, not reproduced. Sending hides the pill, but a subsequent content-size callback can show it again using the historical scroll offset. The deferred jump does not synchronize that offset or pill visibility.

    Code evidence and limits

    Web verification was blocked by missing historical-message fixtures. The event sequence remains unconfirmed.

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

    Add a regression test covering deep-link list replacement, stale offset, content-size callbacks, and no subsequent scroll event. Synchronize offset and pill visibility when the newest-page jump completes, guarded by list readiness. Avoid unconditionally assuming a scroll request succeeded.

    Verify scrolling upward restores the pill; cover offline sends and unread markers.


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


    view run · view recording

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Nov 4, 2026
  6. melvin-bot commented on Nov 4, 2026

    @melvin-bot

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

  7. changed the title [-]Chat - "Latest messages" pill remains visible after sending a message[/-] [+][$175] Chat - "Latest messages" pill remains visible after sending a message[/+] on Nov 4, 2026
  8. melvin-bot commented on Nov 4, 2026

    @melvin-bot
  9. aion-citadel-forge commented on Nov 4, 2026

    @aion-citadel-forge

    Proposal

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

    When opening a chat via a deep link to an older message (where the "Latest messages" pill is visible) and sending a new message, the chat list jumps to the newest messages at the bottom, but the "Latest messages" pill remains visible on screen instead of disappearing.

    What is the root cause of that problem?

    When a report is opened at a deep-linked older message (linkedReportActionID), scrollOffsetRef.current (provided by ActionListContext above InvertedFlashList) holds the non-zero scroll offset (> CONST.REPORT.ACTIONS.ACTION_VISIBLE_THRESHOLD) from the deep-linked position, and isFloatingMessageCounterVisible is true.

    When the current user sends a message from that deep-linked view, useReportActionsNewActionLiveTail.ts runs the live-tail jump sequence:

    1. scrollToBottomForCurrentUserAction (lines 125-136) calls openReportAtLiveTail() and sets liveTailJumpRef.current = {stage: 'open_report'}.
    2. Once openReport finishes loading (src/pages/inbox/report/useReportActionsNewActionLiveTail.ts, lines 191-205), it sets setTreatAsNoPaginationAnchor(true), calls clearLinkedActionParam() (navigation.setParams({reportActionID: ''})), and transitions to stage: 'await_scroll'.
    3. In the next effect (src/pages/inbox/report/useReportActionsNewActionLiveTail.ts, lines 207-221), once hasNewestReportAction is true, it calls setIsFloatingMessageCounterVisible(false) and schedules setIsScrollToBottomEnabled(true) in a microtask:
            liveTailJumpRef.current = {stage: 'await_prune'};
            setIsFloatingMessageCounterVisible(false);
            // Defer so this effect does not synchronously chain a second render from setState (eslint react-hooks/set-state-in-effect).
            queueMicrotask(() => {
                setIsScrollToBottomEnabled(true);
            });
    1. Clearing linkedReportActionID changes listID in src/pages/inbox/report/ReportActionsList/useReportActionsListScroll.ts (line 71: const listID = [reportID, linkedReportActionID, ...].join(':')), which is passed as key={listID} to <InvertedFlashList> (ReportActionsListContent.tsx, line 265). This remounts InvertedFlashList at the bottom (index 0, scroll offset 0), while ActionListContext's scrollOffsetRef.current remains mounted above it and still retains the stale deep-link offset (> ACTION_VISIBLE_THRESHOLD).
    2. When the remounted list fires onContentSizeChange (src/pages/inbox/report/ReportActionsList/useReportActionsListScroll.ts, lines 214-217):
                onContentSizeChange: () => {
                    trackVerticalScrolling(undefined);
                    flushPendingScrollToBottom();
                },

    trackVerticalScrolling(undefined) calls updatePillVisibility() (src/pages/inbox/report/useReportUnreadMessageScrollTracking.ts, lines 98-120) with event === undefined, so scrollOffsetRef.current is not updated. Because scrollOffsetRef.current still holds the old deep-link offset (> CONST.REPORT.ACTIONS.ACTION_VISIBLE_THRESHOLD) and isFloatingMessageCounterVisible was just set to false, updatePillVisibility() immediately sets setIsFloatingMessageCounterVisible(true) again!
    6. Right after that, flushPendingScrollToBottom() runs (src/hooks/useReportActionsScroll.ts, lines 426-433):

        const flushPendingScrollToBottom = () => {
            if (!isScrollToBottomEnabled) {
                return;
            }
            reportScrollManager.scrollToBottom();
            setIsScrollToBottomEnabled(false);
            completeLiveTailPruneAfterScrollToBottom();
        };

    Because the remounted InvertedFlashList is already positioned at index 0 (or scrollToIndex({index: 0, animated: false}) is a no-op at offset 0), no native onScroll event is emitted, scrollOffsetRef.current is never reset to 0, and flushPendingScrollToBottom() never hides the pill or clears the stale offset. Furthermore, any subsequent onContentSizeChange callback after flushPendingScrollToBottom() will continue reading the stale scrollOffsetRef.current > ACTION_VISIBLE_THRESHOLD and re-showing the pill.

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

    In src/hooks/useReportActionsScroll.ts inside flushPendingScrollToBottom (lines 426-433), reset scrollOffsetRef.current = 0 and call setIsFloatingMessageCounterVisible(false) when flushing the pending scroll to the bottom:

        const flushPendingScrollToBottom = () => {
            if (!isScrollToBottomEnabled) {
                return;
            }
            scrollOffsetRef.current = 0;
            setIsFloatingMessageCounterVisible(false);
            reportScrollManager.scrollToBottom();
            setIsScrollToBottomEnabled(false);
            completeLiveTailPruneAfterScrollToBottom();
        };

    Resetting scrollOffsetRef.current = 0 and hiding the floating message counter in flushPendingScrollToBottom ensures that:

    • Even if onContentSizeChange ran trackVerticalScrolling(undefined) right before flushPendingScrollToBottom() (or while isScrollToBottomEnabled was queued), the pill is hidden once the jump to the bottom is flushed.
    • Any subsequent onContentSizeChange (trackVerticalScrolling(undefined)) sees scrollOffsetRef.current === 0 (matching the actual bottom position of the list) and does not re-enable the pill until the user actually scrolls up in history.

    What alternative solutions did you consider?

    We considered resetting scrollOffsetRef.current = 0 when listID changes in useReportActionsListScroll.ts, or swapping the order of flushPendingScrollToBottom() and trackVerticalScrolling(undefined) in onContentSizeChange. However, onContentSizeChange can also fire on the render before the queueMicrotask(() => setIsScrollToBottomEnabled(true)) state update commits, and flushPendingScrollToBottom is also called from onLayout and non-remount live-tail jumps (where hasNewerActions was true without a linkedReportActionID change). Synchronizing scrollOffsetRef.current = 0 and setIsFloatingMessageCounterVisible(false) directly inside flushPendingScrollToBottom() handles both deep-link remount jumps and in-place live-tail jumps in one place.

  10. sonofkratos92 commented on Nov 4, 2026

    @sonofkratos92

    Proposal

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

    When opening a chat from a deep link to an old message and then sending a message, the chat list jumps to the newest messages at the bottom, but the "Latest messages" floating pill remains visible instead of disappearing.

    What is the root cause of that problem?

    1. When a chat is opened from a deep link (linkedReportActionID in route params), <InvertedFlashList key={listID} /> mounts at initialScrollIndex = targetIndex (> 0). Its onScroll handler (trackScrollPositionAndThreshold in src/pages/inbox/report/ReportActionsList/useReportActionsListScroll.ts, lines 146-149) sets scrollOffsetRef.current (stored in ActionListContextProvider, src/pages/inbox/ActionListContext.tsx, line 53) to the deep-linked scroll offset (> CONST.REPORT.ACTIONS.ACTION_VISIBLE_THRESHOLD) and calls onScrolledOverThresholdChange(true) (hasScrolledOverThreshold = true in ReportActionsListContent.tsx, line 119). Once onLoad runs (src/hooks/useReportActionsScroll.ts, lines 436-443), updatePillVisibility() sees currentVerticalScrollingOffsetRef.current > CONST.REPORT.ACTIONS.ACTION_VISIBLE_THRESHOLD and sets isFloatingMessageCounterVisible = true.
    2. When the current user sends a message while viewing the deep-linked message, scrollToBottomForCurrentUserAction in src/pages/inbox/report/useReportActionsNewActionLiveTail.ts (lines 125-136) enters the shouldJumpToLiveTail branch (!!linkedReportActionID is true), sets liveTailJumpRef.current = {stage: 'open_report'}, and calls openReportAtLiveTail().
    3. When openReport finishes (prevIsLoadingInitialReportActions === true && reportLoadingState?.isLoadingInitialReportActions === false), two separate effects in useReportActionsNewActionLiveTail.ts run across consecutive renders:
      • First, the effect at lines 191-205 runs:
        setTreatAsNoPaginationAnchor(true);
        clearLinkedActionParam();
        liveTailJumpRef.current = {stage: 'await_scroll'};
        clearLinkedActionParam() calls navigation.setParams({reportActionID: ''}), changing linkedReportActionID to ''.
      • In the render caused by setTreatAsNoPaginationAnchor(true) and clearLinkedActionParam(), listID in useReportActionsListScroll.ts (line 71: [reportID, linkedReportActionID, ...].join(':')) changes immediately. This unmounts the deep-linked <InvertedFlashList key={listID} /> and mounts a brand-new <InvertedFlashList> instance at scroll offset 0 (initialScrollIndex = undefined).
      • Crucially, during the render in which the new <InvertedFlashList> mounts and fires its initial onLayout and onContentSizeChange, isScrollToBottomEnabled is still false, because the second effect at lines 207-221:
        liveTailJumpRef.current = {stage: 'await_prune'};
        setIsFloatingMessageCounterVisible(false);
        queueMicrotask(() => {
            setIsScrollToBottomEnabled(true);
        });
        only runs after hasNewestReportAction becomes true (once treatAsNoPaginationAnchor is true), and then further defers setIsScrollToBottomEnabled(true) inside a queueMicrotask.
    4. Because the remounted <InvertedFlashList> starts at offset 0, it never emits an onScroll event. Meanwhile, scrollOffsetRef.current in ActionListContextProvider still holds the stale deep-linked offset (> CONST.REPORT.ACTIONS.ACTION_VISIBLE_THRESHOLD), and hasScrolledOverThreshold in ReportActionsListContent remains true (which also leaves maintainVisibleContentPosition.disabled = false and useMarkAsRead's isScrolledToEnd = false).
    5. When onContentSizeChange fires on the list (useReportActionsListScroll.ts, lines 214-217):
      onContentSizeChange: () => {
          trackVerticalScrolling(undefined);
          flushPendingScrollToBottom();
      },
      • If onContentSizeChange fires before the queueMicrotask sets isScrollToBottomEnabled = true, flushPendingScrollToBottom() returns early at if (!isScrollToBottomEnabled) return;. And once isScrollToBottomEnabled flips to true on the subsequent render, if layout and content size have already settled on the remounted list, flushPendingScrollToBottom() (and completeLiveTailPruneAfterScrollToBottom()) does not run until a future layout/content-size event.
      • And whenever onContentSizeChange runs (either during initial layout or after pruneReportActionPagesToNewestWindow prunes older pages), trackVerticalScrolling(undefined) calls updatePillVisibility() (src/pages/inbox/report/useReportUnreadMessageScrollTracking.ts, lines 98-110), which reads the stale currentVerticalScrollingOffsetRef.current > CONST.REPORT.ACTIONS.ACTION_VISIBLE_THRESHOLD and immediately calls setIsFloatingMessageCounterVisible(true), turning the "Latest messages" pill back on.
    6. Offending PR / Regression History:

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

    1. Reset scrollOffsetRef.current and hasScrolledOverThreshold when releasing the linked-action anchor and jumping to the live tail:
      • Pass onScrolledOverThresholdChange into useReportActionsScroll and expose a resetScrollToBottomState callback (which sets scrollOffsetRef.current = 0, calls onScrolledOverThresholdChange(false), and calls setIsFloatingMessageCounterVisible(false)) to useReportActionsNewActionLiveTail.
      • In src/pages/inbox/report/useReportActionsNewActionLiveTail.ts, call resetScrollToBottomState() when releasing the linked-action anchor (in the open_report completion effect at lines 202-204, the await_scroll effect at lines 215-220, and the offline linked-action send branch at lines 139-143) so that scrollOffsetRef.current is 0 and hasScrolledOverThreshold is false before the remounted <InvertedFlashList key={listID} /> mounts and runs onContentSizeChange.
    2. Flush pending scroll-to-bottom when isScrollToBottomEnabled becomes true and reset scroll state inside flushPendingScrollToBottom:
      • In src/hooks/useReportActionsScroll.ts inside flushPendingScrollToBottom (lines 426-433), also call resetScrollToBottomState(), and invoke flushPendingScrollToBottom() from an effect when isScrollToBottomEnabled becomes true (once the list ref is laid out) so the scroll and pagination prune are not missed if onLayout / onContentSizeChange already fired before the queueMicrotask render:
        const flushPendingScrollToBottom = () => {
            if (!isScrollToBottomEnabled) {
                return;
            }
            scrollOffsetRef.current = 0;
            onScrolledOverThresholdChange(false);
            setIsFloatingMessageCounterVisible(false);
            reportScrollManager.scrollToBottom();
            setIsScrollToBottomEnabled(false);
            completeLiveTailPruneAfterScrollToBottom();
        };
    3. Run flushPendingScrollToBottom() before trackVerticalScrolling(undefined) in onContentSizeChange:
      • In src/pages/inbox/report/ReportActionsList/useReportActionsListScroll.ts (lines 214-217):
        onContentSizeChange: () => {
            flushPendingScrollToBottom();
            trackVerticalScrolling(undefined);
        },

    What alternative solutions did you consider?

    1. Only resetting scrollOffsetRef.current = 0 inside flushPendingScrollToBottom(): This is not sufficient on its own because clearLinkedActionParam() remounts <InvertedFlashList key={listID} /> in the render before queueMicrotask(() => setIsScrollToBottomEnabled(true)) commits, so isScrollToBottomEnabled is still false when the remounted list fires its initial onLayout and onContentSizeChange, and hasScrolledOverThreshold in ReportActionsListContent would also stay true (leaving maintainVisibleContentPosition enabled and useMarkAsRead's isScrolledToEnd as false).
    2. Resetting scrollOffsetRef.current = 0 in ActionListContext.registerListRef on every unmount/mount: ReportActionsListThresholdTest specifically requires scrollOffsetRef.current to persist across mount when preserving scroll position above the threshold. Resetting scrollOffsetRef.current = 0 and onScrolledOverThresholdChange(false) specifically during a live-tail / scroll-to-bottom jump preserves mount-time threshold behavior.
  11. camesenin commented on Nov 4, 2026

    @camesenin
  12. melvin-bot commented on Nov 4, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  13. 33 remaining items

  14. expensify-chore-bot commented on Nov 15, 2026

    @expensify-chore-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  15. expensify-chore-bot commented on Nov 15, 2026

    @expensify-chore-bot

    Payment Summary

    Resolving PRs:

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  16. mallenexpensify commented on Nov 17, 2026

    @mallenexpensify
    Contributor

    Claude posting on behalf of Matt:

    Ready. Job price: $175 (standard, no Help Wanted, assigned 2026-11-04).

    • ikevin127 (C+): 100%, via NewDot

    No deploy blockers. The offending PRs 100793 and 104242 name no payee.

    Next: press Caps+Y, then pay.

    Evidence
    • C+ checklist, 6 test steps: comment
    • TestRail case: none yet.
    • Resolving PR 106064: by Melvin, merged 2026-11-06, approved by NicolasBonet and ikevin127. No revert.
    • Videos: C+ 3/3.

    PAYPREP v1

  17. mallenexpensify commented on Nov 19, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @ikevin127 due $175 via NewDot

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