Conversation
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const isReportUnread = isUnread(report, transactionThreadReport, isReportArchived); | ||
| const isReportUnreadInitially = useRef(isReportUnread); |
There was a problem hiding this comment.
Unread-state ref never reset when report changes
The initial unread state for a report is stored in isReportUnreadInitially with useRef, but the ref is never reset when reportID changes. When navigating from a read report to an unread one without unmounting (common when switching chats), isUnreadMessagePageLoadingInitially stays false because it reads the stale ref, so we skip waiting for OpenReport to fetch the oldest unread page and render using cached newest actions instead. That causes the unread report to open at the wrong position and may immediately mark it as read. The ref needs to be refreshed when the report context changes.
Useful? React with 👍 / 👎.
| return sortedAllReportActions?.findLast((reportAction) => { | ||
| if (!initialReportLastReadTime.current) { | ||
| return false; | ||
| } | ||
|
|
||
| return reportAction.created > initialReportLastReadTime.current; | ||
| })?.reportActionID; |
There was a problem hiding this comment.
Oldest unread lookup uses lastReadTime from previous report
usePaginatedReportActions caches initialReportLastReadTime in a ref and then uses it here to pick the first action created after that timestamp. Because the ref is never reset when reportID changes, switching to another report without unmounting compares that report’s actions against the last-read time of the previous report. The hook can therefore fail to return the actual oldest unread action (or treat the report as already read), breaking navigation to unread messages on subsequent report openings.
Useful? React with 👍 / 👎.
Explanation of Change
Fixed Issues
$
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))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.ScrollViewcomponent to make it scrollable when more elements are added to the page.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
MacOS: Desktop