-
-
Notifications
You must be signed in to change notification settings - Fork 593
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: should check sticky scroll bar visible when table height changed #1076
fix: should check sticky scroll bar visible when table height changed #1076
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
e45b4f6
to
d8c8f9a
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1076 +/- ##
==========================================
+ Coverage 50.21% 50.26% +0.04%
==========================================
Files 97 97
Lines 9065 9074 +9
Branches 631 634 +3
==========================================
+ Hits 4552 4561 +9
Misses 4463 4463
Partials 50 50 ☔ View full report in Codecov by Sentry. |
// The best way is to use ResizeObserver to detect the body height, but this way is enough | ||
React.useEffect(() => { | ||
checkScrollBarVisible(); | ||
}, [data]); |
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.
data 放这里很容易触发的,如果写成字面量对象的。
改成 data.length 是不是就够了?
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.
这个方式已经很保守了,你说的这个,比如切换分页时,新的文本可能很长跟原来的差很多可能就有问题了。
fix ant-design/ant-design#47331
fix ant-design/ant-design#33762
结论:最好的方式是用 ResizeObserver 监听 table body 高度(会耗一些性能),但是目前做法也是够用
2024-02-04.16.28.54.mov