Migrate Reports page to use it's own FlatList#57549
Conversation
|
|
|
|
|
|
|
|
4d3496f to
207d8d1
Compare
blazejkustra
left a comment
There was a problem hiding this comment.
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.
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 |
|
@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.
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.
@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.
99% sure this is a mistake
| shouldEnableMaxHeight | ||
| offlineIndicatorStyle={styles.mtAuto} | ||
| bottomContent={<BottomTabBar selectedTab={BOTTOM_TABS.SEARCH} />} | ||
| bottomContent={!searchRouterListVisible && <BottomTabBar selectedTab={BOTTOM_TABS.SEARCH} />} |
There was a problem hiding this comment.
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.
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.
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.
Also, could you please link the issue 🙏
There was a problem hiding this comment.
@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.
App/src/components/SelectionList/index.tsx
Lines 74 to 76 in c3451e1
This edge case was missed during the migration, we fixed it in issue #59420. :)
| contentContainerStyle={contentContainerStyle} | ||
| showsVerticalScrollIndicator={false} | ||
| ref={listRef} | ||
| extraData={focusedIndex} |
There was a problem hiding this comment.
We should have included isFocused in extra data as well. Not doing so caused #66726
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 Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop