Repository navigation
Don't show the New messages marker above the user's own message on first open - #105113
Conversation
…ed it Add isReportActionFromCurrentUser and use it in useUnreadMarker and shouldDisplayNewMarkerOnReportAction. Co-authored-by: Vinh Hoang <hoangzinh@users.noreply.github.com>
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
🤖 Android test steps verification results: On standalone Android NewDot, sending and leaving the chat worked, and the regression check passed: another account's unread message still gets the New marker. The PR's main fix could not be tested. That test needs a second signed-in session of the same account to create a stale
|
|
🤖 Web test steps verification results: On dev NewDot web, sending a message and leaving the chat worked. The PR's main fix and the regression check could not be tested: they need a second, separately signed-in session of the same account (or a reply from another account), and the test setup supports only one browser session. Concierge also did not reply within about a minute.
|
|
The failing check is unrelated to this PR, so I didn't push a fix. Analysis:
Evidence: At least 9 unrelated PRs failed the same Other runs with the same failure
The other failing check, |
|
@MelvinBot can you try add tests for this PR description? |
|
@MelvinBot update PR author checklist with this Details
|
|
I added test steps to the PR description, based on the repro in the linked issue.
I haven't run these steps. The setup needs several sessions on one account, which my test environment can't create. Please run them before you tick the checkboxes. |
|
✅ I updated the PR Author Checklist in the PR description to match your list. All 36 items are now checked, and I didn't change anything else in the description. |
|
@MelvinBot mark this PR ready for review |
|
@hoangzinh Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
I marked this PR as ready for review. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Reviewer Checklist
Screenshots/VideosScreen.Recording.2026-10-30.at.17.21.08.mov |
|
@MelvinBot merge latest main to resolve "Reassure Performance Tests" failed |
…ipSelfAuthoredAnchor Co-authored-by: Vinh Hoang <hoangzinh@users.noreply.github.com>
|
@mjasikowski Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
The failing What to do: Re-run the Reassure Performance Tests run. I couldn't trigger the re-run from here. Why it's unrelated
|
|
The failing Why this failure is unrelated
|
| // Another session can have a stale lastReadTime, so the anchor may be the user's own message sent from a | ||
| // different device. Leave that case to the scan, which never places a fresh marker on a self-authored action. |
There was a problem hiding this comment.
| // Another session can have a stale lastReadTime, so the anchor may be the user's own message sent from a | |
| // different device. Leave that case to the scan, which never places a fresh marker on a self-authored action. | |
| // A stale lastReadTime can make a message sent by the current user on another device the pagination anchor. | |
| // Use the scan result instead when the current user authored that action. |
| // Given a comment written by the current user | ||
| const action = {...createRandomReportAction(1), actionName: CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT, actorAccountID: currentUserAccountID} as ReportAction; | ||
|
|
||
| // When / Then the action is attributed to the current user through actorAccountID |
There was a problem hiding this comment.
| // When / Then the action is attributed to the current user through actorAccountID | |
| // When checking whether the action is from the current user | |
| // Then it matches because actorAccountID equals currentUserAccountID |
| // Given a comment written by someone else | ||
| const action = {...createRandomReportAction(1), actionName: CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT, actorAccountID: otherUserAccountID} as ReportAction; | ||
|
|
||
| // When / Then the action is not attributed to the current user |
There was a problem hiding this comment.
| // When / Then the action is not attributed to the current user | |
| // When checking whether the action is from the current user | |
| // Then it does not match because actorAccountID belongs to another user |
| }); | ||
|
|
||
| it('uses childLastActorAccountID for a report preview', () => { | ||
| // Given a report preview created by someone else whose latest child action came from the current user |
There was a problem hiding this comment.
| // Given a report preview created by someone else whose latest child action came from the current user | |
| // Given a report preview where actorAccountID belongs to another user | |
| // and childLastActorAccountID belongs to the current user |
| childLastActorAccountID: currentUserAccountID, | ||
| } as ReportAction; | ||
|
|
||
| // When / Then the preview is attributed to the child report's last actor, not to the preview's own actor |
There was a problem hiding this comment.
| // When / Then the preview is attributed to the child report's last actor, not to the preview's own actor | |
| // When checking whether each preview is from the current user | |
| // Then childLastActorAccountID determines the result, regardless of actorAccountID |
| }); | ||
|
|
||
| it('returns false for an undefined action', () => { | ||
| // Given no action / When / Then nothing is attributed to the current user |
There was a problem hiding this comment.
| // Given no action / When / Then nothing is attributed to the current user | |
| // Given no report action | |
| // When checking whether it is from the current user | |
| // Then the check returns false because there is no author to match |
| }); | ||
|
|
||
| it('does not use the oldestUnread anchor on first open when the current user authored the anchored action', () => { | ||
| // Given another session whose stale lastReadTime makes the user's own message (sent from a different device) the oldest unread |
There was a problem hiding this comment.
| // Given another session whose stale lastReadTime makes the user's own message (sent from a different device) the oldest unread | |
| // Given an action from the current user that is newer than the session's lastReadTime |
| hasOnceLoadedReportActions: false, | ||
| }); | ||
|
|
||
| // Then no marker is shown, because the user has already seen their own message |
There was a problem hiding this comment.
| // Then no marker is shown, because the user has already seen their own message | |
| // Then no marker is shown because the current user authored the anchor action |
| }); | ||
|
|
||
| it('does not use the oldestUnread anchor on first open when the current user is the last actor of the anchored report preview', () => { | ||
| // Given a report preview anchor whose own actor is someone else but whose latest child action came from the current user |
There was a problem hiding this comment.
| // Given a report preview anchor whose own actor is someone else but whose latest child action came from the current user | |
| // Given a report preview anchor where actorAccountID belongs to another user | |
| // and childLastActorAccountID belongs to the current user |
mjasikowski
left a comment
There was a problem hiding this comment.
Need some comment changes
|
Nothing has changed since my last comment, so I didn't push a fix. The failure is still the same flaky To clear it: someone with permission needs to re-run the failed job in the Reassure run. I don't have permission to re-run it here. The fix for the flaky test, [No QA] Mock fetch in ReportActionsListRowWrites perf test, is still open. After it merges, you can merge
|
|
Nothing has changed since my earlier analysis, so there's no code fix to push. What to do: Open the failed perf test run and select Re-run failed jobs. I don't have permission to re-run it myself. The failure is a flaky render count in
|
|
@MelvinBot can you check @mjasikowski's feedbacks above? |
Co-authored-by: Vinh Hoang <hoangzinh@users.noreply.github.com>
|
I applied all 9 of
Only comments changed, so the code behaves the same. I couldn't run Jest in this environment, so CI will run the tests on this commit. |
|
🚧 mjasikowski has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mjasikowski in version: 9.5.27-0 🚀
|
|
No help site update needed. This bug fix stops the "New messages" marker from appearing above your own message sent from another device, which is what users already expect, and no help article describes that marker. |
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.5.27-2 🚀
Bundle Size Analysis (Sentry): |




Explanation of Change
When the same account is signed in on more than one device, a session can have a stale
report.lastReadTime. On first open,usePaginatedReportActionsthen picks the user's own message (sent from another device) as the oldest unread "pagination anchor". The marker scan correctly refuses to place a fresh marker on a self-authored action, butuseUnreadMarkerfell back to the anchor whenever the scan returnednull. The marker landed on the user's own message and then stuck, because it was stored asprevUnreadMarkerReportActionID.This PR:
isReportActionFromCurrentUser(reportAction, currentUserAccountID)toReportActionsUtils. It useschildLastActorAccountIDfor report previews andactorAccountIDfor everything else.shouldDisplayNewMarkerOnReportActionin place of the inlineisFromCurrentUserexpression (no behavior change).useUnreadMarkerso the pagination anchor is used as the marker only when the current user did not author it. Scroll positioning is unchanged.Known edge case: if the stale anchor is the user's own message and a newer message from another user follows it, no marker is shown on that session. Before this change, the marker sat above the user's own message. Moving the marker to the other user's message would need a change to the scan's
nextMessagehandling, which is outside the approved proposal.AI tests run locally:
jest tests/unit/useUnreadMarkerTest.ts tests/unit/ReportActionsUtilsTest.ts tests/ui/UnreadIndicatorsTest.tsx: passed (554 passed, 2 skipped)npm run typecheck: passednpm run lint-changed: passedFixed Issues
$ #104178
PROPOSAL: #104178 (comment)
Tests
Precondition: Sign in to the same account (User A) in three sessions: Session 1 (for example, the native app or a browser), Session 2 (another browser), and Session 3 (a third browser or an incognito window).
Own message from another device does not get the marker
Messages from other users still get the marker (regression)
8. In Sessions 1, 2, and 3, leave the chat with User B so it is not open.
9. Sign in as User B in a separate browser and send a message to User A.
10. In Session 2, open the chat with User B.
11. Verify the "New messages" marker appears above User B's message.
Offline tests
N/A. This change only affects where the client places the "New messages" marker for report actions that are already loaded. It does not add or change any API calls.
QA Steps
Same as tests. To match the original report, use the Hybrid app for Session 1, mWeb Safari for Session 2, and mWeb Chrome for Session 3.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari