-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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
fix(charts): Table Chart doesn't twitch when resizing #20833
Conversation
- Handle resize properly when only the scrollbar is changing so it doesn't get stuck into an infinite loop.
Codecov Report
@@ Coverage Diff @@
## master #20833 +/- ##
==========================================
+ Coverage 66.34% 66.35% +0.01%
==========================================
Files 1756 1756
Lines 66747 66769 +22
Branches 7059 7064 +5
==========================================
+ Hits 44282 44306 +24
+ Misses 20667 20663 -4
- Partials 1798 1800 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. |
|
||
useLayoutEffect(() => { | ||
// After initial load the table should resize only when the new sizes | ||
// Are not only scrollbar updates, otherwise, the table would twicth |
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.
Appreciate the comments! This helps SOOOO much.
- Handle resize properly when only the scrollbar is changing so it doesn't get stuck into an infinite loop. (cherry picked from commit 234c446)
SUMMARY
The problem is that when the table is rendering our
useResizeDetector
triggers changes to hide the scrollbar if necessary which causes that width and height from props are always changing and the component enters into an infinite loop. We are detecting the changes and applying the resize only if the new difference (any) is not related to the scrollbar size.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
After:
TESTING INSTRUCTIONS
Expected results:
ADDITIONAL INFORMATION