-
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
Chat loader flickering #32124
Chat loader flickering #32124
Conversation
@abdulrahuman5196 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] |
Hi @perunt Unit tests are failing in this PR, seems to be related to this PR? Could you kindly check on the same? And screenshots are also not added yet. Kindly let me know if UI changes won't be visible for the PR as well. |
@abdulrahuman5196 done |
Thank you. Will take a look in my morning. Also the author's checklist is not complete yet. Kindly take a look into that as well. @perunt |
@abdulrahuman5196, how's it going? |
Hi, Rechecking now. |
@@ -199,7 +200,7 @@ function ReportActionsView(props) { | |||
const loadNewerChats = useMemo( | |||
() => | |||
_.throttle(({distanceFromStart}) => { | |||
if (props.isLoadingNewerReportActions || props.isLoadingInitialReportActions) { | |||
if (props.isLoadingNewerReportActions || props.isLoadingInitialReportActions || isNewestReportAction) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this isNewestReportAction
will most likely always be true
. Since as soon as we have the actions for display, we are setting the first report action to have isNewestReportAction: true
and checking the same here.
When can this value be false, so that we will loadNewerChats
function will fetch new data?
I am not sure if I had understood clearly, kindly clarify if I misunderstood.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before all, we must remember that we cannot show some specific range of reportActions in the list. We constantly mix them all and sort them. Comment linking brings the ability to cut sequences chank of sorted messages and will help not to include missed places.
Firstly, we need to figure out when we need to fetch new report actions. Answer - when we locate not on the end of the list. What I mean:
- when you were offline and received 1000 report actions. Once you return online, call
OpenReport
and get the latest 50 reportAction. So your last message, the latest before moving offline now, is different.
You havecurrent report action -> gap with 950 items -> the latest 50 elements.
In this case, we need to fetch new items when we reach that gap with 950 el - the same stuff for comment linking. Once we were navigated to the middle of a chat, we should be able to fetch a newer report action when scrolling down
In the rest cases, we do not need this functionality since Pusher keeps this up-to-date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed with @perunt Offline and it seems for now isNewestReportAction
will be rarely false. As part next sequent PRs loadNewerChats
will be further updated to fullest extent.
@abdulrahuman5196 you can also use test steps from this PR |
Checking now again |
@abdulrahuman5196, was it successful? |
Hi @perunt working on it. Will close out in an hour. |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2023-12-06.at.10.14.04.PM.mp4Android: mWeb ChromeScreen.Recording.2023-12-06.at.10.20.01.PM.mp4iOS: NativeScreen.Recording.2023-12-06.at.10.07.19.PM.mp4iOS: mWeb SafariScreen.Recording.2023-12-06.at.10.10.20.PM.mp4MacOS: Chrome / SafariScreen.Recording.2023-12-06.at.9.58.11.PM.mp4MacOS: DesktopScreen.Recording.2023-12-06.at.10.01.58.PM.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes looks good and works well. Reviewers checklist is also complete.
All yours. @roryabraham
🎀 👀 🎀
C+ Reviewed
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/roryabraham in version: 1.4.9-0 🚀
|
1 similar comment
🚀 Deployed to staging by https://github.com/roryabraham in version: 1.4.9-0 🚀
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.4.9-5 🚀
|
Issue: The
onStartReached
function is being triggered more frequently than necessary. It leads to the loader flickeringWhen onStartReached is Necessary:
Solution:
Introduce
isNewestReportAction
Flag: This flag will be attached to the most recent report actions. It serves as an indicator to decide whether to callonStartReached
.Application in Comment Linking: When using comment links, we'll isolate a specific array of reports from Onyx for the user. If the first item (the newest in an inverted list) has the
isNewestReportAction
flag, it signifies that triggeringonStartReached
is not required.Handling Offline Scenarios: Upon reconnection, the true latest report action is obtained from OpenReport and marked by us with
isNewestReportAction
. This helps determine the necessity ofonStartReached
.Our goal is to reduce redundant data fetching, thereby improving efficiency and the user experience. This is especially crucial in handling large volumes of messages and in scenarios involving reconnection after being offline.
Details
Fixed Issues
$ #30729 (comment)
#30495 (comment)
PROPOSAL:
Tests
Open a chat and check the bottom loader, you shouldn't see it.
Scroll to the top and bottom to check if it appears.
Send messages.
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
telegram-cloud-document-2-5420290165396487348.mp4
Android: mWeb Chrome
iOS: Native
Nov-29-2023.09-43-18.mp4
iOS: mWeb Safari
Nov-29-2023.09-47-02.mp4
MacOS: Chrome / Safari
Screen.Recording.2023-11-29.at.09.29.36.mov
Untitled480.mov
MacOS: Desktop
Untitled.2.mov