-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[$250] Self DM - Chat is not scrolled to the bottom when clicking 'New message' #40911
Comments
Triggered auto assignment to @MitchExpensify ( |
@MitchExpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors |
We think that this bug might be related to #vip-vsp |
Heads up I don't think this bug is exclusive to the Self-DM. |
Job added to Upwork: https://www.upwork.com/jobs/~0199f7298343d8bc01 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @dukenv0307 ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Chat is not scrolled to the bottom when clicking 'New message' What is the root cause of that problem?the following PR has introduced the current issue, where when the user clicks on new message it doesn't scroll to the bottom
What changes do you think we should make in order to solve the problem?
const scrollToBottomWithoutDelay = useCallback(() => {
if (!flatListRef?.current) {
return;
}
flatListRef.current.scrollToOffset({animated: false, offset: 0});
}, [flatListRef]);
const scrollToBottom = useCallback(() => {
requestAnimationFrame(() => {
scrollToBottomWithoutDelay();
});
}, [scrollToBottomWithoutDelay]); |
ProposalPlease re-state the problem that we are trying to solve in this issue.Chat is not scrolled to the latest message What is the root cause of that problem?We're executing From the documentation of requestAnimationFrame
That means an animation is executed along with What changes do you think we should make in order to solve the problem?To make sure
What alternative solutions did you explore? (Optional)We can use |
ProposalPlease re-state the problem that we are trying to solve in this issue.Self DM - Chat is not scrolled to the bottom when clicking 'New message' What is the root cause of that problem?
What changes do you think we should make in order to solve the problem?You need to introduce delays between animations to prevent them from overlapping. You can use setTimeout to introduce delays in the animation sequence here. Update the scrollToBottom function as mention below:
In the specific context of scrollToBottom function, combining requestAnimationFrame with setTimeout(() => { ... }, 0) ensures that the scrolling operation occurs after the current stack has cleared, which can help prevent potential issues related to timing and synchronization with the rendering pipeline. Video: |
Will review proposals in a hour |
Thanks for all your proposals @abzokhattab Your RCAs don't convince me enough. -> Why is @ikevin127 Can you help identify the correct RCA since you're the author of that change? Thanks |
This comment was marked as outdated.
This comment was marked as outdated.
@dukenv0307 I confirm that this issue is a regression caused by PR #40286 from issue #38855. This happened because here we chose to go with In order to fix this we could either use Things to consider moving forward with a fix for this issue: #40724 (comment). |
Aha. I think we can revert the PR and think of a better solution. I don't think setTimeout and requestanimationframe are better solutions. |
Got it, can this issue be combined with #40724 ? |
@parasharrajat What do you think about the suggestion to consolidate with #40724? |
We should revert the PR #40286 that caused this issue and close it. |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 1.4.65-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: N/A
Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
Chat should be scrolled to the latest message
Actual Result:
Chat is not scrolled to the latest message
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6460218_1713968475100.Screen_Recording_2024-04-24_at_5.20.32_in_the_afternoon.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: