-
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
Move logic to start report actions list at index to BaseInvertedFlatList #52149
base: main
Are you sure you want to change the base?
Move logic to start report actions list at index to BaseInvertedFlatList #52149
Conversation
db777e7
to
da55621
Compare
@ishpaul777 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] |
As you can see in the videos there seems to be a lot of jumping going on after comment linking on native platforms (ios / android). It also happens on main so it is not related to this change. I will try to take some time soon to investigate those, especially important since we're going to use that case more now if opening at last unread. |
@rlinoz Are you able to consistently reproduce? I am trying the same thing as the video, but the messages do load. This is with messages already in cache. |
Its on my radar, i'll review try to review this sometime tmrw 🙇 |
@ishpaul777 friendly bump
I will check again and try to get better steps |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-12-15.at.1.53.29.AM-1-1.movAndroid: mWeb ChromeScreen.Recording.2024-12-15.at.2.07.31.AM.moviOS: NativeScreen.Recording.2024-12-15.at.1.14.40.AM-1.moviOS: mWeb SafariScreen.Recording.2024-12-15.at.1.23.40.AM.movMacOS: Chrome / SafariScreen.Recording.2024-12-15.at.1.40.07.AM-1.movMacOS: DesktopScreen.Recording.2024-12-15.at.2.24.52.AM-1.mov |
Bug?: New message fetching and redering is quite jerky as compare to staging it often skips many messages load to end staging Screen.Recording.2024-11-18.at.1.38.18.AM.movThis branch Screen.Recording.2024-11-18.at.1.36.27.AM.mov |
@ishpaul777 I can reproduce the problem, looking at it now, thanks! |
That was harder that I thought to fix, I missed part of what the code did. It also handle pagination cases when new items are added, it adds it progressively to make sure no jumping happens. |
Bug: Now i can't scroll down after linking to Screen.Recording.2024-11-21.at.12.17.07.AM.mov |
@@ -582,7 578,7 @@ function ReportActionsList({ | |||
({item: reportAction, index}: ListRenderItemInfo<OnyxTypes.ReportAction>) => ( | |||
<ReportActionsListItemRenderer | |||
reportAction={reportAction} | |||
reportActions={reportActions} | |||
reportActions={sortedReportActions} |
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.
i dont understand the intention of doing this, Can you please clarify?
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.
ah i got it sortedReportActions and reportActions are same reportActions passed from ReportActionsView.tsx
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.
Yea, kind of unrelated cleanup
Oh strange, I was testing this exact case. Will check tomorrow. |
Seems to only happen if the screen is high enough, that's why I didn't catch it during testing. I can now repro. |
Hey @janicduplessis any news on this one? |
Hey, I haven't had much availability in the past few weeks, will try to pickup work on it soon! |
@janicduplessis Did you get chance to look into this? |
Sorry about the delay, will be able to look at this tomorrow. |
@ishpaul777 Are you still able to reproduce the issue? Weirdly I am not able to anymore even with increasing my screen resolution like I did last time. |
i'll test again shortly 🙇 |
I can still reproduce, but on a different message not the first Screen.Recording.2024-12-07.at.2.39.13.AM.mov |
@ishpaul777 I was finally able to reproduce the bug again. I am not sure exactly how, but once the app state is like this it happens all the time. Basically if the CREATED action and the message we are linking to is loaded in cache, OpenReport is never called because of this code here. This code is there to avoid calling OpenReport if we think that the data is already loaded, but it fails if the CREATED action is already loaded since it checks in sortedAllReportActions instead of the current page of data (reportActions). To fix it I changed to check only in the current page of data (reportActions). Let me know if that fixes it for you, it is hard to validate the fix as I am not able to consitently reproduce it. |
I also noticed a little bit more jumping than usual when linking to the first message, I will see if I can fix that too. I suspect that moving the comment linking logic to BaseInvertedFlatList changed a bit how much ReportActionsView renders so it uncovered some bugs. |
I added some more logic to limit how fast new items are added to the start of the list and now the jumping is gone. |
i am jammed with many other priority tasks today will try to review tomorrow/coming days. |
Hey @ishpaul777 did you have time to take a look at it? also, @janicduplessis apparently we have some conflicts now |
Yes I'll review today |
Conflicts fixed |
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.
lgtm!
I think we may have broken the jump to new message button, but I can't repro every time
Screen.Recording.2024-12-16.at.11.01.51.mov |
@janicduplessis friendly bump on the above |
Any updates @janicduplessis ? |
Explanation of Change
This PR is the first step towards being able to open chats at the last unread message. We currently have some logic to open a chat at a specific message for comment linking, but this code is heavily coupled with the comment linking code and ReportActionsView. This moves the logic that allows the list to open at a specific index to
BaseInvertedFlatList
which will make it easy to reuse for opening chat at last unread also.FlatList
has ainitialScrollIndex
prop, but it doesn't work very well, it also doesn't work at all if the index is too big and is not rendered initially. To avoid this problem we implemented a workaround in the comment linking code. What we do is render the list initially from the initial index we want and progressively add items before it inonStartReached
.This code can actually be completely decoupled from the comment linking logic and just make the
initialScrollIndex
prop ofBaseInvertedFlatList
use that same logic. This is what this PR does.Fixed Issues
$ #35011
PROPOSAL:
Tests
Offline tests
QA Steps
Test 1: Basic Navigation
Note: Links can be copied to any message and used in any order.
Test 2: Popup Navigation
Test 3: Cache and Logout
Test 4:
Notes:
Ensure the chat contains at least 150 messages. Initially, up to 50 messages are rendered. Navigating to the 70th message should allow further navigation up to the 150th message, even with gaps.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.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
Screen.Recording.2024-11-06.at.20.25.35.mov
Android: mWeb Chrome
Screen.Recording.2024-11-06.at.20.41.28.mov
iOS: Native
Screen.Recording.2024-11-06.at.20.24.18.mov
iOS: mWeb Safari
Screen.Recording.2024-11-06.at.20.49.38.mov
MacOS: Chrome / Safari
Screen.Recording.2024-11-06.at.19.13.27.mov
MacOS: Desktop
Screen.Recording.2024-11-06.at.19.45.38.mov