-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Migrate Reports page to use it's own FlatList #57549
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
Migrate Reports page to use it's own FlatList #57549
Conversation
|
|
|
|
4d3496f
to
207d8d1
Compare
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.
Overall, the refactor looks very solid! Tested it on web and I instantly see the difference 👍
I think that selecting all items doesn't work atm @SzymczakJ
shouldPreventDefaultFocusOnSelectRow?: boolean; | ||
}; | ||
|
||
function SearchList( |
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.
This component looks much cleaner than its counterpart (SelectionList). Great refactor! 🚀
@ikevin127 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] |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid.webmAndroid: mWeb Chromeandroid-mweb.webmiOS: Nativeios.mp4iOS: mWeb Safariios-mweb.mp4MacOS: Chrome / Safariweb.movMacOS: Desktopdesktop.mov |
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 and tests well
@SzymczakJ we have conflicts |
Discussed 1:1 with @SzymczakJ and we decided to wait merging this PR until he's back from ooo, in case there are deploy blockers and we don't have the capacity to fix them. |
FYI I'll be OOO for the next week and I'll be back on 25.03.2025, then we can merge ASAP! |
I've retested this PR and made sure it's still helping with the performance 😄, the results are simillar. |
Merged! Nice work |
✋ 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/luacmartins in version: 9.1.19-0 🚀
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.1.19-5 🚀
|
const handleLongPressRow = useCallback( | ||
(item: SearchListItem) => { | ||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
if (!isSmallScreenWidth || item?.isDisabled || item?.isDisabledCheckbox || !isFocused) { |
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.
An early return condition was missing here for chat reports which caused the following regression issue:
this was fixed by passing a new prop shouldPreventLongPressRow
when isChat
(true) in order to disable long press row functionality.
|
||
return ( | ||
<ListItem | ||
showTooltip={false} |
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.
@ikevin127 @SzymczakJ Coming from #59656, I want to confirm again whether this change is intentional or just a mistake
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.
99% sure this is a mistake
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 agree
@@ -119,7 +119,7 @@ function SearchPageNarrow({queryJSON, policyID, searchName}: SearchPageNarrowPro | |||
testID={SearchPageNarrow.displayName} | |||
shouldEnableMaxHeight | |||
offlineIndicatorStyle={styles.mtAuto} | |||
bottomContent={<BottomTabBar selectedTab={BOTTOM_TABS.SEARCH} />} | |||
bottomContent={!searchRouterListVisible && <BottomTabBar selectedTab={BOTTOM_TABS.SEARCH} />} |
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.
Hello! @SzymczakJ Could you help confirm what issue this commit fixes? I wasn’t able to identify any specific problem that it resolves. The only thing I noticed is that the bottom tab bar appears above the keyboard on Android mWeb Chrome — but that also happens on production.
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.
Yes, that line was supposed to fix that, but now when I look at it, it was broken by adding TopLevelBottomTabBar
to RootNavigatorExtraContent
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.
If you come up with a PR for that, please ping me, because I'm curious how the solution will look like.
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.
Also, could you please link the issue 🙏
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.
@SzymczakJ Yeah, I asked because I saw that it caused this issue: #60017. It looks like reverting it works correctly and resolved the issue above, since it didn’t resolve the issue as mentioned.
if (isMobileChrome() && event.nativeEvent && !event.nativeEvent.sourceCapabilities) { | ||
return; | ||
} | ||
setFocusedIndex(index); |
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.
App/src/components/SelectionList/index.tsx
Lines 74 to 76 in c3451e1
// Ignore the focus if it's caused by a touch event on mobile chrome. | |
// For example, a long press will trigger a focus event on mobile chrome. | |
shouldIgnoreFocus={isMobileChrome() && isScreenTouched} |
This edge case was missed during the migration, we fixed it in issue #59420. :)
Explanation of Change
This PR removes SelectionList from Reports Page, as it introduces a lot of unnecessary calculation and creates a lot of performance issues. Instead of that we use FlatList with some of the necessary features of SelectionList like "moving through items with keyboard" or "scolling to and highliting an item". I carefully moved them to a new component SearchList which greatly helps with performance.
I made some benchmarks between the old version of Reports screen and new version, I was measuring total time spent on calculating rerenders(and useEffects/useLayoutEffects) caused by entering Reports Page and also number of total commits. I made these benchmarks for iOS and Android platforms, as they the biggest performance problems and I was measuring it on emulator/simulator.
Old version:
Total time/number of commits spent on calculating rerenders:
New version:
Total time/number of commits spent on calculating rerenders:
Fixed Issues
$ #57191
$ #57069
$ #57170
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests.
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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop