Improve ActiveHoverable CPU performance#54744
Conversation
…to zirgulis/improve-ActiveHoverable-cpu-performance
|
🚧 @mountiny has triggered a test build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪
|
|
@mountiny I'm not sure what are the testing steps for the Fullstory QA part, therefore left as TBD in PR's the description |
|
I have added some generic steps, I am also not sure about anything specific to check but mainly just checking if the sessions are looking fine |
|
@zirgulis is there a GH issue this is associated with? And is this ready for C+ review/testing or not yet? |
|
It is coming from this thread in quality https://expensify.slack.com/archives/C05LX9D6E07/p1736326697079059 Made an issue for it and assigned you all 🙌 #55652 @brunovjk can you please complete the review and testing? @amyevans for the QA I think the crucial part is to ensure in staging that the fullstory sessios are recorded just fine even after this change (hence InternalQA) |
I'm afk for a couple of hours, I will review it as soon as I get home. If it's urgent, please reassign |
|
Okay great, thanks for creating the issue!
Cool, I verified I see sessions in FS currently following the |
Reviewer Checklist
Screenshots/VideosAndroid: NativeN/A Android: mWeb ChromeN/A iOS: NativeN/A iOS: mWeb SafariN/A MacOS: Chrome / Safari54744_chrome.mov54744_chrome_perf_result.movMacOS: Desktop54744_desktop.mov |
|
@mountiny do we need any more reviewers/approvals? |
|
@mountiny you want to take a look too or nah? |
|
@amyevans All good, going to merge it now that you approved, thank you! |
|
✋ 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/mountiny in version: 9.0.90-0 🚀
|
|
✅ Internal QA passes on staging |
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.0.90-6 🚀
|
| if (!elementRef.current?.contains(event.target as Node) && !elementRef.current?.contains(event.relatedTarget as Node) && !shouldFreezeCapture) { | ||
| setIsHovered(false); | ||
| } |
There was a problem hiding this comment.
removing this logic caused a regression here #57022, we fix it removing the whole logic for onblur, as it was no longer relevant.
| isScrollingRef.current = scrolling; | ||
| if (!isScrollingRef.current) { | ||
| setIsHovered(isHoveredRef.current); | ||
| if (scrolling && isHovered) { |
There was a problem hiding this comment.
The hovered state here can be late to be updated, causing this issue, so we opt for a ref instead.
Explanation of Change
The ActiveHoverable component manages hover states for interactive elements in our web interface. The original implementation used multiple event listeners, including a global document-level mouseover listener, which was causing performance overhead, especially in views with many hoverable elements.
Fixed Issues
$ #55652
PROPOSAL:
Optimize hover state management by:
Tests
ActiveHoverable component is used everywhere across the web/desktop application, therefore it's CRUCIAL to test and validate that it works the same as before.
Testing steps:
Offline tests
Testing steps:
QA Steps
Testing steps:
Fullstory testing:
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
Screen.Recording.2025-01-22.at.17.15.26.mp4
MacOS: Desktop
Screen.Recording.2025-01-22.at.17.22.10.mp4