chore: Virtualize rendering of conversations (WPB-15154) #18529
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces virtualized rendering for the conversations list in the left sidebar of the application, leveraging the
@tanstack/react-virtual
library. The change optimizes the rendering of large conversation lists by only rendering items visible within the viewport, significantly improving performance and resource efficiency.Changes
1. Integration of
@tanstack/react-virtual
@tanstack/react-virtual
to the project dependencies.useVirtualizer
hook to manage virtualized rendering of the conversations list.2. Updated
ConversationsList
Componentref
for the scrollable container to support virtualization.Benefits
1. Performance Improvements
2. Improved User Experience
3. Scalability
Rendering:
Screen.Recording.2024-12-18.at.8.00.02.PM.mov
Below numbers are measured on a Apple Macbook 2020 with M1 CPU
Memory:
Screen.Recording.2024-12-19.at.1.40.00.PM.mov
Frame rate & GPU usage without virtualization
Screen.Recording.2024-12-19.at.1.51.59.PM.mov
Frame rate & GPU usage with virtualization
Screen.Recording.2024-12-19.at.1.53.10.PM.mov
Measured performance when scrolling without virtualization
Measured performance when scrolling with virtualization