If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
What performance issue do we need to solve?
- inefficient React component rendering
What is the impact of this on end-users?
- app boot time
- chat switch time
List any benchmarks that show the severity of the issue
- Start the web app and be on a chat
- Open the dev console
- Go to the Performance tab
- Start capturing data
- Switch to another chat
- Wait a few seconds for loading to settle
- Stop capturing data
- Review results

- Task 1 - is processing the click and transitioning to another chat - it totals to 868ms for me (Starting on reportID: 71955477)
- A huge part of Task 1 is dedicated to unmounting components - 546ms. All the little needles under
unmountHostComponents
- About ~450 of those are
withWindowDimensions HOCs
- And around 80 are
withOnyx HOCs
Profile data (you can load this in Chrome/Performance): https://u.pcloud.link/publink/show?code=XZwvKwXZpXUhxs7Vdr7kaco3HDxznYmcP7sX
Proposed solution (if any)
HOC usages should be gradually reduced as much as possible
They cause 1+ component for each component that uses them
I've described how to change withWindowDimensions here: #2326 (DimensionsContextProvider)
This will leave withWindowDimensions usages throughout the app unchanged, but they will at least not be class based components and would not run class component lifecycle
ReportActionItem should be updated not to be HOC based (if possible) as they are the most rendered component
They can receive window related props from the parent renderItem as well as Onyx related props
List any benchmarks after implementing the changes to show impacts of the proposed solution (if any)
Note: These should be the same as the benchmarks collected before any changes.
This is not at all the final result, but it does show some improvement after converting the withWindowDimensions wrappings not to be class based

Platform:
Where is this issue occurring?
- Web (Affected more due to higher count of HOCs - popups, hoverable items etc...)
- iOS
- Android
- Desktop App (Affected more due to higher count of HOCs - popups, hoverable items etc...)
- Mobile Web
Version Number: 1.0.85-0
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Expensify/Expensify Issue URL:
View all open jobs on Upwork
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
What performance issue do we need to solve?
What is the impact of this on end-users?
List any benchmarks that show the severity of the issue
unmountHostComponentswithWindowDimensionsHOCswithOnyxHOCsProfile data (you can load this in Chrome/Performance): https://u.pcloud.link/publink/show?code=XZwvKwXZpXUhxs7Vdr7kaco3HDxznYmcP7sX
Proposed solution (if any)
HOC usages should be gradually reduced as much as possible
They cause 1+ component for each component that uses them
I've described how to change
withWindowDimensionshere: #2326 (DimensionsContextProvider)This will leave
withWindowDimensionsusages throughout the app unchanged, but they will at least not be class based components and would not run class component lifecycleReportActionItemshould be updated not to be HOC based (if possible) as they are the most rendered componentThey can receive window related props from the parent
renderItemas well as Onyx related propsList any benchmarks after implementing the changes to show impacts of the proposed solution (if any)
Note: These should be the same as the benchmarks collected before any changes.

This is not at all the final result, but it does show some improvement after converting the
withWindowDimensionswrappings not to be class basedPlatform:
Where is this issue occurring?
Version Number: 1.0.85-0
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Expensify/Expensify Issue URL:
View all open jobs on Upwork