-
Notifications
You must be signed in to change notification settings - Fork 279
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
CRS-384 Upgrade react-virtuoso to v1 #694
Conversation
} | ||
/> | ||
); | ||
}, | ||
[MessageDeleted, customMessageRenderer, shouldGroupByUser], | ||
[ | ||
MessageDeleted, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can probably remove MessageDeleted from dep array, it shouldn't change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if I'd remove this. Even if it shouldn't change this, it technically could, and it doesn't really hurt to have it in the dependencies array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this raises a larger question of how we handle dependency arrays. On the react native side we only include the data that should actually trigger a new render during an app session, so we don't include things like prop UI components that don't change mid-session. Obviously native is a little different, but we definitely saw performance improvements and decreased re-renders upon getting stricter with the dependency arrays. @mahboubii do you have thoughts on whether or not to keep UI components in dependency arrays?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There could be customers who change the UI props conditionally in their app but the performance gain from removing this dependency check is worth it IMO and we should move toward that path.
In the meantime since changing these effect dependencies are potentially a breaking change, let's leave it as is until the next major release.
we should make it clear for customers that UI prop overrides should not change after the first render of the app
Footer, | ||
}; | ||
}, [ | ||
EmptyStateIndicator, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same with EmptyState and Typing
@ath92 I'll admit I don't have much background on this feature but it looks pretty good, will wait for Amin to check it out too. Though in the meantime can you replace @ts-ignore with @ts-expect-error? This will help us when we get to converting this file and will notify you if there's not a type error to follow. |
looks like the new |
Codecov Report
@@ Coverage Diff @@
## master #694 +/- ##
==========================================
- Coverage 85.87% 85.79% -0.08%
==========================================
Files 154 155 +1
Lines 3108 3140 +32
Branches 746 754 +8
==========================================
+ Hits 2669 2694 +25
- Misses 327 332 +5
- Partials 112 114 +2
Continue to review full report at Codecov.
|
Size Change: +36 kB (2%) Total Size: 1.54 MB
ℹ️ View Unchanged
|
I think I've addressed the comments in this review so far, but I'm running into an issue: sometimes the I'm not sure why this happens - as far as I can tell we're not doing anything different from the examples provided on the Virtuoso website. Perhaps @petyosi has some idea on why this could be happening? (let me know if it makes more sense to try and create a more minimal example of the problem and open an issue in the virtuoso repo instead) |
I have been struggling with this problem in this issue: petyosi/react-virtuoso#281 - check if debouncing the callback handle won't resolve it. If not, a repro will help me. Notice that the OS matters - if you reproduce it on Mac, then you are probably facing something different. |
0df4861
to
6d04f8c
Compare
Got some time to look into this again: The issue I was seeing was unrelated to the issue you mentioned here (and unrelated to virtuoso), but caused by how we handle prepending items to our channel state. In short: the promise that is returned by I pushed a workaround for this that doesn't depend on the timing of the |
6d04f8c
to
6ecde4b
Compare
3ec1946
to
b7aaee5
Compare
@mahboubii @DanC5 @virdesai please take a look |
@DanC5 let's give this a review when possible |
b52d973
to
e786509
Compare
scrollSeekPlaceHolder, | ||
Message = FixedHeightMessage, | ||
Message = DefaultMessage, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing that a fixed height message might not be required anymore, is it possible to use the MessageTeam
component in the virtualized list now?
Looks like this Message property requires a type with FixedHeightMessageProps
still, so not sure how to do it...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petyosi can you speak to the feasibility of using our other Message UI components in the VL now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kainosnoema indeed, using "any" messages in the virtual list is something which we are looking into, but not yet ready to introduce as the default configuration. The part which does not work as smoothly as we wish is messages which contain img
elements without a specified size. Such posts may cause the virtual list to "jump" when the image is loaded.
This being said, you can ignore the typing for now and try passing the plain message - we would love to get your feedback on the performance of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petyosi thanks for the update. We're building our own custom message component and will be having photo galleries with a fixed height (when attachments are present), so don't think we'll run into the jumping issue. We'll give this a shot!
Submit a pull request
CLA
Description of the pull request
Upgrades react-virtuoso to the latest version available. A refactor of
VirtualizedMessageList
was required to adapt to the breaking changes introduced with this new version. In particular, some extra work was needed to handle the new way virtuoso deals with prepending messages.Improvements:
Message
andFixedHeightMessage
Not included:
Squash the commits before merging, a lot of back and forth.