Skip to content
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

Remove react virtualized #2

Merged
merged 3 commits into from
Dec 26, 2023
Merged

Remove react virtualized #2

merged 3 commits into from
Dec 26, 2023

Conversation

yhware
Copy link
Member

@yhware yhware commented Dec 26, 2023

✍️ Describe your changes

Removing React Virtualized

Previously 'react-virtualized' library was used to optimize the performance of chat message listing. If there were a few thousand messages, browser would perform poorly. Virtualized lists exist to fix such a problem.

However, I decided to remove 'react-virtualized' because of the following reasons.

  1. Poor performance
    I noticed that when using CellMeasurer component to dynamically size each row (chat msg), performance suffered.
    Further discssion on the issue can be found at CellMeasurer optimizations bvaughn/react-virtualized#341
react-virtualized.poor.performance.mp4
normal-scroll.mp4
  1. Too complex API
    implementing a complex chat system with react-virtualized was a poor dev experience and made the development sluggish.

This however does not mean I intend to give up on the performance. I will first build out chat screen and then find other optimizations after that. It seems offloading some chat messages from the screen could be a solution.
For example, let's say a user is looking at 100 messages at a time. We can store 100 + BUFFER amount of messages in the mobx store and pull the rest from the server as needed and offloading messages outside the visible + BUFFER range.

Other changes

  • Removed react-window dependency. It was not used. Forgot to delete it from before.
  • Removed @uidotdev/usehooks dependency. It was used to replace AutoSizer of react-virtualized to dynamically measure the width/height of chat list container. Since react-virtualized is removed, this is also not needed.
  • Added "scroll to bottom" bottom on chat screen
  • Added "no messages" icon to chat message list and reply message list.
  • Fixed chat channel page layout shrinking issues.

🎟 ️Issue ticket number and link

closes #1

✅ Checklist before requesting a review

  • I have performed a self-review of my code
  • If it is a core feature, I have added thorough tests.

@yhware yhware added the enhancement New feature or request label Dec 26, 2023
@yhware yhware self-assigned this Dec 26, 2023
@yhware yhware merged commit b4725e3 into main Dec 26, 2023
@yhware yhware deleted the remove-react-virtualized branch December 26, 2023 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove 'react-virtualized' dependency
1 participant