-
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 2023-09-29] [$500] Report - Conversation history does not scroll down after sending a message and IOU #26432
Comments
Triggered auto assignment to @sakluger ( |
Bug0 Triage Checklist (Main S/O)
|
@lanitochka17, I reported the same bug 10 days ago. You can find the details here: https://expensify.slack.com/archives/C049HHMV9SM/p1692633002201879. could you credit my name when addressing this? Thank you |
ProposalPlease re-state the problem that we are trying to solve in this issue.When a new message is sent by the current user, the app does not automatically scroll to the bottom. What is the root cause of that problem?The bug was introduced by this PR #18637. In this PR, this scrolling logic was removed from the The behavior before this PR was: in the previous commit (before that PR), If a new message is sent and it's from the current user the app scroll to the bottom: App/src/pages/home/report/ReportActionsView.js Lines 155 to 161 in 8cd29e6
What changes do you think we should make in order to solve the problem?Integrate the // In the component we are subscribing to the arrival of new actions.
// As there is the possibility that there are multiple instances of a ReportScreen
// for the same report, we only ever want one subscription to be active, as
// the subscriptions could otherwise be conflicting.
const newActionUnsubscribeMap = {}; useEffect(() => {
// Why are we doing this, when in the cleanup of the useEffect we are already calling the unsubscribe function?
// Answer: On web, when navigating to another report screen, the previous report screen doesn't get unmounted,
// meaning that the cleanup might not get called. When we then open a report we had open already previosuly, a new
// ReportScreen will get created. Thus, we have to cancel the earlier subscription of the previous screen,
// because the two subscriptions could conflict!
// In case we return to the previous screen (e.g. by web back navigation) the useEffect for that screen would
// fire again, as the focus has changed and will set up the subscription correctly again.
const previousSubUnsubscribe = newActionUnsubscribeMap[report.reportID];
if (previousSubUnsubscribe) {
previousSubUnsubscribe();
}
// This callback is triggered when a new action arrives via Pusher and the event is emitted from Report.js. This allows us to maintain
// a single source of truth for the "new action" event instead of trying to derive that a new action has appeared from looking at props.
const unsubscribe = Report.subscribeToNewActionEvent(report.reportID, (isFromCurrentUser) => {
// If a new comment is added and it's from the current user scroll to the bottom otherwise leave the user positioned where
// they are now in the list.
if (!isFromCurrentUser)
return;
reportScrollManager.scrollToBottom();
});
const cleanup = () => {
if (unsubscribe) {
unsubscribe();
}
Report.unsubscribeFromReportChannel(report.reportID);
};
newActionUnsubscribeMap[report.reportID] = cleanup;
return () => {
cleanup();
};
}, [report.reportID, reportScrollManager]); Result: 31.New.Expensify.Mozilla.Firefox.2023-09-01.01-39-29.mp4What alternative solutions did you explore? (Optional)Alternative 1: Reintegrate the import useReportScrollManager from '../../../hooks/useReportScrollManager'; const reportScrollManager = useReportScrollManager(); // In the component we are subscribing to the arrival of new actions.
// As there is the possibility that there are multiple instances of a ReportScreen
// for the same report, we only ever want one subscription to be active, as
// the subscriptions could otherwise be conflicting.
const newActionUnsubscribeMap = {}; useEffect(() => {
// Why are we doing this, when in the cleanup of the useEffect we are already calling the unsubscribe function?
// Answer: On web, when navigating to another report screen, the previous report screen doesn't get unmounted,
// meaning that the cleanup might not get called. When we then open a report we had open already previosuly, a new
// ReportScreen will get created. Thus, we have to cancel the earlier subscription of the previous screen,
// because the two subscriptions could conflict!
// In case we return to the previous screen (e.g. by web back navigation) the useEffect for that screen would
// fire again, as the focus has changed and will set up the subscription correctly again.
const previousSubUnsubscribe = newActionUnsubscribeMap[reportID];
if (previousSubUnsubscribe) {
previousSubUnsubscribe();
}
// This callback is triggered when a new action arrives via Pusher and the event is emitted from Report.js. This allows us to maintain
// a single source of truth for the "new action" event instead of trying to derive that a new action has appeared from looking at props.
const unsubscribe = Report.subscribeToNewActionEvent(reportID, (isFromCurrentUser) => {
// If a new comment is added and it's from the current user scroll to the bottom otherwise leave the user positioned where
// they are now in the list.
if (!isFromCurrentUser)
return;
reportScrollManager.scrollToBottom();
});
const cleanup = () => {
if (unsubscribe) {
unsubscribe();
}
Report.unsubscribeFromReportChannel(reportID);
};
newActionUnsubscribeMap[reportID] = cleanup;
return () => {
cleanup();
};
}, [reportID, reportScrollManager]); Alternative 2: We could potentially examine the sortedReportActions prop of ReportActionsList inferring the arrival of a new action solely based on prop changes as an alternative to the listener. |
Job added to Upwork: https://www.upwork.com/jobs/~016b9e851c8568700f |
Current assignee @sakluger is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mollfpr ( |
@mollfpr, could you please review my proposal when you get a chance? Thank you! |
Thanks @rayane-djouah I'll do the review today! |
Sorry for the delay @rayane-djouah Is there any reason why we remove the listener? Is there any related to the performance improve? |
Thanks for the review, @mollfpr. |
the commit was added after this comment |
Is there any way without the listener? |
Current implementation: Notification: With notifyNewAction, when a new action occurs, the relevant subscriber's callback is triggered based on the reportID, giving real-time updates. App/src/libs/actions/Report.js Lines 187 to 219 in edab657
Usage: Report.js and IOU.js use the notifyNewAction to alert of new actions App/src/libs/actions/Report.js Line 363 in edab657
Line 595 in edab657
Considering an alternative without the listener would mean a fundamental change in our approach, potentially leading to new regressions. What do you think @mollfpr ? |
@mollfpr, We could potentially examine the sortedReportActions prop of ReportActionsList as an alternative to the listener. However, subscribing to the event emitted from Report.js ensures that we maintain a single source of truth for the "new action" event. This is preferable to inferring the arrival of a new action solely based on prop changes. |
@rayane-djouah I try your listener solution, but it's only sometimes working. Screen.Recording.2023-09-06.at.12.15.17.mov |
@mollfpr I updated my proposal with the correct solution. |
video.mp4 |
@rayane-djouah I'm okay with the proposal. To make sure, I am asking for clarification in the PR. |
@mollfpr if you get a positive response, let's hold the assignment till the end of the merge freeze 🥶 |
@thienlnam could you review the PR when you get a chance? Thank you! |
Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:
On to the next one 🚀 |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.72-11 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 2023-09-29. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
For reference, here are some details about the assignees on this issue:
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
@sakluger, @mollfpr, @thienlnam, @rayane-djouah Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
the PR was approved by C+ within 2 days of assignment, and it was waiting for only the Engineer's approval & merge (+2 days after C+ approved), and in this stage it exceeds the 3 days rule, and the engineer had no major requested changes to the PR once they reviewed. is this issue eligible for urgency bonus? |
Yes, I reviewed the PR timeline and this one qualifies for the efficiency bonus. I'm going through and writing up payments now. |
Summarizing payouts for this issue: Bug reporter: @rayane-djouah $50 (paid via Upwork) Above payments include efficiency bonus 🎉 |
@mollfpr can you please confirm if you'd prefer to be paid via Upwork or NewDot? You've already accepted the Upwork contract, so if you'd like to be paid via NewDot I'd have to cancel that. Also, can you please complete the BZ checklist? Thanks! |
@sakluger I think from Upwork is okay since we already have the contract. Completing the checklist now. |
https://github.com/Expensify/App/pull/18637/files#r1318079323
I don't think we can have a checklist to prevent this. The regression step should be good.
|
Thanks! Just sent the payment through Upwork @mollfpr. Regression test steps look good, thanks! |
Issue reproducible on latest build - v1.3.96-0 Android / native Screen_Recording_20231107_235340_New.Expensify.mp4 |
@izarutskaya I think we should create a new issue for this instead of reopening this issue |
We're handling in here #30947 |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Preconditions:
Log in using a HIGH traffic account.
Expected Result:
When you send a message or IOU in a conversation, the message history should scroll down without artifacts to the newly sent message or IOU
Actual Result:
When sending a message or IOU in a conversation, the message history doesn't scroll down, and on Native apps the conversation history starts scrolling chaotically up to down
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.60-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
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
Notes/Photos/Videos: Any additional supporting documentation
Bug6184276_Recording_KI_22367_Android.mp4
Expensify/Expensify Issue URL:
Issue reported by: @rayane-djouah
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1692633002201879
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: