-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HOLD for payment 2024-11-07] [$250] Chat: "Unread" marker appears when the user sends a new message #50469
Comments
Triggered auto assignment to @lschurr ( |
I would like to curate this so assigning myself |
Do you need BugZero on this @MonilBhavsar or will it be all internal? |
We need BugZero and C+ on this. Going to export it |
Job added to Upwork: https://www.upwork.com/jobs/~021844272500597248585 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ikevin127 ( |
Edited by proposal-police: This proposal was edited at 2024-10-10 08:56:49 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.The "New messages" pill appears; What is the root cause of that problem?unreadMarkerReportActionID returns the new action when users add new comment, the reason is because we don't have the logic to exclude the message that comes from current user What changes do you think we should make in order to solve the problem?In App/src/pages/home/report/ReportActionsList.tsx Lines 483 to 488 in 175af25
when checking
What alternative solutions did you explore? (Optional)
|
Edited by proposal-police: This proposal was edited at 2024-10-15 14:10:25 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.An unread marker shows every time we add a message. What is the root cause of that problem?This happens after #49367. Previously, we ignore any message that the current user sends, unless the user mark it as unread manually. The unread marker shows because the scroll offset is out of the threshold (250) and App/src/pages/home/report/ReportActionsList.tsx Lines 224 to 226 in 285bde8
App/src/pages/home/report/ReportActionsList.tsx Lines 125 to 131 in 285bde8
The App/src/pages/home/report/ReportActionsList.tsx Lines 202 to 214 in 285bde8
For the 3rd case, we have this App/src/pages/home/report/ReportActionsList.tsx Lines 265 to 278 in 285bde8
What changes do you think we should make in order to solve the problem?We will have a new When user adds a new message and there is currently an unread marker, the For example, the current user mark A as unread: then, the current user sends a message. prevUnreadMarkerReportActionID will now contain A.
What alternative solutions did you explore? (Optional)We need to add a new case for updating Luckily, we already have an observer to detect a new message from the current user.
App/src/pages/home/report/ReportActionsList.tsx Lines 341 to 353 in 285bde8
We can update the To do that, we can have a new ref called
It's important to check for existing unread marker to not remove it when adding a new message, which is the current behavior. If we want to remove the marker when adding a new message, then we can remove the App/src/pages/home/report/ReportActionsList.tsx Lines 371 to 385 in 285bde8
Next, adds a
Next, return false here if the report action is the same as the last action added by user. App/src/pages/home/report/ReportActionsList.tsx Lines 220 to 227 in 285bde8
Last, we need to clear App/src/pages/home/report/ReportActionsList.tsx Lines 245 to 251 in 285bde8
|
♻️ Reviewing proposals... |
From my experience with the Given this I'm inclined to go with bernhardoj's proposal since it mentioned the offending PR which caused the issue and also both RCA and solution proposed are more detailed and consider multiple aspects of the current functionality - hence it shows better understanding of the issue at hand. However, before moving on with assignment here I want test the proposed solution thoroughly and because I don't want to miss any part of the solution, @bernhardoj can you please share a test branch with the complete solution so I can test it ? ♻️ Will get back on this once I get the chance to test the proposed solution. |
@ikevin127 here is the test branch |
@bernhardoj Thanks for putting together the test branch, I got to test the fix implementation and while it does seem to work compared to staging: Compare Videos
Tip Steps to reproduce
Note The same thing happens if the steps are followed on 2 different sessions of the local dev (with testing branch) for example if logging in with the same account and following the above steps on 2 different browsers. Here's a video for better visualisation: Videostaging-test-issue.movGiven this, from my side I see two issues here:
|
I updated my proposal with a different solution to cover that (and moved the previous main solution as the alternative). |
This comment was marked as outdated.
This comment was marked as outdated.
I reviewed @bernhardoj's updated proposal's main solution again and this time it passed the tests. For reference, here's how I implemented the solution locally: Solution Code const [session] = useOnyx(ONYXKEYS.SESSION);
const prevUnreadMarkerReportActionID = usePrevious(unreadMarkerReportActionID);
const currentUserAccountID = Number(session?.accountID);
const lastAction = sortedVisibleReportActions.at(0);
useEffect(() => {
if (prevUnreadMarkerReportActionID || !lastAction) {
return;
}
const isFromCurrentUser = currentUserAccountID === (ReportActionsUtils.isReportPreviewAction(lastAction) ? !lastAction.childLastActorAccountID : lastAction.actorAccountID);
if (!isFromCurrentUser || lastAction.created <= unreadMarkerTime) {
return;
}
setUnreadMarkerTime(lastAction.created);
}, [prevUnreadMarkerReportActionID, lastAction?.created]); Tip Notes for PR
🎀👀🎀 C+ reviewed |
Current assignee @MonilBhavsar is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new. |
Thanks for the detailed proposal! |
📣 @ikevin127 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
I'm still struggling to make the solution fully works. If you see the video below, while doing it offline (easier to repro), the unread marker will still show briefly. ios.mweb.mp4With the current solution, we can't really avoid that because the |
I'm rethinking to reuse the previous solution. The advantage of the previous solution is that we can tell that there is a new message added by the current user before If we read the comment here, the observer/subscriber is supposed to receive the event either locally or from Pusher. App/src/pages/home/report/ReportActionsList.tsx Lines 376 to 378 in 40e2230
However, currently the event is only triggered inside the notification callback. So, it's only triggered if the user will receive a notification which being guarded by some conditions. App/src/libs/actions/Report.ts Line 2498 in 40e2230
App/src/libs/actions/Report.ts Lines 2467 to 2470 in 40e2230
Lines 746 to 750 in 40e2230
The solution is to move the
With the previous + new solutions above, the unread marker won't show if the current user adds a message, either from the current client or a different client. @ikevin127 what do you think? NOTE: sending message from the 2nd client will scroll to bottom the first client too. This is the same as WhatsApp. |
@bernhardoj Thanks for catching the offline behaviour issue, didn't think to test that scenario with the previous solution. #50469 (comment) sounds good to me, I'd say you can move forward and start working on the PR with the (1st) previous solution + the new solution mentioned in above comment. Unless @MonilBhavsar has any objections to #50469 (comment), I'd say you're good to go. Note We just have to make sure we test properly and also make sure to add code comments for the new code additions in order for other contributors to know why and what the code does and why the |
PR is ready cc: @ikevin127 |
♻️ Status update: We're working on reviewing and fixing edge cases in the PR, hopefully will be merged in 1-2 days. |
Thanks for the update! The new solution looks right 👍 |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.55-10 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2024-11-07. 🎊 For reference, here are some details about the assignees on this issue:
|
@ikevin127 @lschurr The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button] |
BugZero Checklist:
Bug classificationSource of bug:
Where bug was reported:
Who reported the bug:
Regression Test ProposalTest:
Note An easier way to test this is to go offline / back online after posting a message, then there's no need to immediately scroll to the top, especially on small screen where there's no draggable scrollbar. Please refer to the issue's description for see of how the issue was reproduced to better understand how to verify that the issue is not reproducible anymore. Do we agree 👍 or 👎. |
Payment summary:
|
Requested in ND. |
$250 approved for @bernhardoj |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.46-2
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @paultsimura
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1728390912425749
Action Performed:
Expected Result:
Since the user is the author of the message:
Actual Result:
The "New messages" pill appears;
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
2024-10-08.-.14_19.-.Screen.Recording.2024-10-08.at.14.18.44.mp4
Recording.640.mp4
Add any screenshot/video evidence
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @lschurrThe text was updated successfully, but these errors were encountered: