Repository navigation
Scroll to the user's own comment in expense reports when the new-message indicator is showing - #103174
Conversation
…omment Co-authored-by: Abdelrahman Khattab <abzokhattab@users.noreply.github.com>
|
I created this PR from an upstream branch because I don't have push access to your fork. To take ownership of this branch and push updates, run: Then you can close this PR and open a new one from your fork. |
|
🤖 Android test steps verification results: ❌ fail The Android run never reached the PR's code. The app froze while I was adding the first expense to a new workspace expense report, and one Metro restart didn't recover it. The failures below are from that freeze, not evidence that the fix doesn't work.
|
|
@MelvinBot This PR fixes The actual code path for single-transaction reports goes through 1. Fix The condition 2. Fix After the live-tail jump sets |
|
@MelvinBot make the Explanation of Change concise |
Revert the useMoneyRequestReportScroll change, which only runs for multi-expense reports. For single-expense reports, scroll straight to the bottom when the unread marker is set but the newest actions are already loaded, and flush a pending scroll-to-bottom on the next frame instead of waiting for a list layout event. Co-authored-by: Abdelrahman Khattab <abzokhattab@users.noreply.github.com>
|
I reworked the fix to target the single-expense path in 5dce362. Both changes are in, and I reverted the earlier
I added 3 unit tests, and 2 of them fail without the fix. Typecheck, lint, the React Compiler check, and the affected test suites pass. I didn't run the full test suite or test manually on web. I also updated the PR description, and it's shorter now. |
|
I shortened the Explanation of Change to one sentence, two bullets (one per changed hook), and a one-line AI tests summary. I also removed the note about reverting |
|
Yes. The "New messages" pill should hide, because the issue's expected result is "the list scrolls to comment and the indicator hides." The "New" divider line above B's comment is different: it stays for the session by design, the same as in regular chats. I think this PR caused the pill to come back. The live-tail hook now hides the pill ( Suggested fix: when the hook scrolls to the bottom itself, clear I haven't confirmed this at runtime. From the code, FlashList's next viewability report should hide the pill again about 250 ms later, so I'd expect a flicker rather than a pill that stays. A log in Why main hid the pill, and why the divider stays
Reply with |
|
The live-tail hook (
The money-request hook ( Changes needed:
Tests should also be added to verify |
Without this, the New divider stayed visible and the unread marker turned the New messages pill back on after the scroll. Co-authored-by: Abdelrahman Khattab <abzokhattab@users.noreply.github.com>
|
I added the
I tested both paths. The direct-scroll test now checks the call. A new test checks that nothing is marked as read while The affected test suites, typecheck, lint, the React Compiler check, and spelling pass. I didn't run the full test suite or test manually on web. I also updated the PR description. |
|
@codex @MelvinBot 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 654e67a284
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } else { | ||
| setIsFloatingMessageCounterVisible(false); | ||
| reportScrollManager.scrollToBottom(); | ||
| markAsReadAfterScroll(); |
There was a problem hiding this comment.
Avoid marking unloaded actions read while offline
When the user is offline, shouldJumpToLiveTail is false even if hasNewerActions is true or the newest action is not loaded, so sending an action reaches this call and readNewestAction() advances lastReadTime to the current time. Once the queued request syncs, unseen newer messages are treated as read; defer marking until the newest actions are loaded, matching the existing hasNewerActions guard in useMarkAsRead.
Useful? React with 👍 / 👎.
|
|
||
| liveTailJumpRef.current = {stage: 'await_prune'}; | ||
| setIsFloatingMessageCounterVisible(false); | ||
| markAsReadAfterScroll(); |
There was a problem hiding this comment.
Recheck report focus before marking the live tail read
On web, previous report screens can remain mounted after navigation, so if a user starts this openReport live-tail jump and switches reports before loading finishes, this effect still runs and marks the old report read even though its newly loaded messages were never viewed. Recheck that this report is still the topmost/focused report before calling markAsReadAfterScroll().
Useful? React with 👍 / 👎.
ReviewThe new 1.
2. Extra network write for every sent comment ( This branch runs for every comment the current user sends while not jumping to the live tail. That includes when they're already at the bottom with nothing unread. Suggested fix: Remove both Minor: The new I reviewed the code only. I didn't run the app. |
|
@MelvinBot simplify Explanation of Change and make test steps same as in the issue #103157 ,,, then mark the PR as ready |
|
I updated the PR description and marked the PR as ready for review.
My earlier review finding is still open. The |
|
@abzokhattab 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 reverted the The reverts remove:
These changes stay: the AI tests: the two affected test files (46 tests), typecheck, lint, and the React Compiler check pass. I didn't run the formatter here. The reverts only delete lines, so the files match the already-formatted state of 2a215e8. |
trjExpensify
left a comment
There was a problem hiding this comment.
The title of this PR is a bit weird. It makes it sound like we pin an expense report preview in a chat to the latest comment or something. Can we update it to be more reflective of what the PR is changing?
|
@MelvinBot Address Nicolas's review by replacing the Specifically:
onContentSizeChange={() => {
trackVerticalScrolling(undefined);
flushPendingScrollToBottom();
}}This way the flush happens when the list content actually changes size (i.e. after FlashList lays out the new row), not on a timing guess via rAF. The guard |
…of on the next frame Co-authored-by: Abdelrahman Khattab <abzokhattab@users.noreply.github.com>
|
I replaced the
The affected Jest suites, typecheck, lint, and React Compiler check pass. I couldn't run the |
|
@MelvinBot Please update the PR title and description per trjExpensify's feedback: New title: New Explanation of Change (replace the current one): When you send a comment while scrolled up in an expense report with the new-message indicator showing, the list now scrolls down to your comment.
|
|
Thanks @NicolasBonet @trjExpensify covered all comments |
|
I updated the PR title and the Explanation of Change to match your text. I kept the existing "AI tests run by MelvinBot" line below the explanation. The rest of the description is unchanged. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 NicolasBonet has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/NicolasBonet in version: 9.5.10-0 🚀
|
|
No help site update is needed. This bug fix makes an expense report scroll to the comment you just sent, which is what users already expect, and no article under |
|
🚀 Deployed to staging by https://github.com/NicolasBonet in version: 9.5.12-0 🚀
|
|
No help site update is needed. This is a bug fix: the expense report now scrolls to the comment you just sent, which is what users already expect, and no article under |
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.5.12-1 🚀
Bundle Size Analysis (Sentry): |









Explanation of Change
When you send a comment while scrolled up in an expense report with the new-message indicator showing, the list now scrolls down to your comment.
useReportActionsNewActionLiveTail: when an unread marker is present but the newest actions are already loaded, scroll directly to the bottom instead of triggering a redundantopenReportround trip. Also removes an unreachable dead-code branch.ReportActionsList: flush a pending scroll-to-bottom fromonContentSizeChange, which fires after FlashList measures the new row. In aligned-to-top reports (expense, invoice, transaction thread),onLayoutalone does not fire on new content.AI tests run by MelvinBot: affected unit tests, typecheck, lint, and React Compiler check pass.
Fixed Issues
$ #103157
PROPOSAL: #103157 (comment)
Tests
Precondition: User A and User B are both members of an IOU expense report that has enough comments to scroll.
Offline tests
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, 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.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Screenshots and videos will be added in the reviewer checklist.
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari