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

fix: should check sticky scroll bar visible when table height changed #1076

Merged
merged 5 commits into from
Feb 5, 2024

Conversation

linxianxi
Copy link
Contributor

@linxianxi linxianxi commented Feb 4, 2024

fix ant-design/ant-design#47331
fix ant-design/ant-design#33762

结论:最好的方式是用 ResizeObserver 监听 table body 高度(会耗一些性能),但是目前做法也是够用

2024-02-04.16.28.54.mov

Copy link

vercel bot commented Feb 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
table ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2024 9:24am

src/stickyScrollBar.tsx Outdated Show resolved Hide resolved
src/stickyScrollBar.tsx Outdated Show resolved Hide resolved
src/Table.tsx Outdated Show resolved Hide resolved
Copy link

codecov bot commented Feb 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (356eb90) 50.21% compared to head (0b59d5c) 50.26%.

❗ Current head 0b59d5c differs from pull request most recent head 7094e2b. Consider uploading reports for the commit 7094e2b to get more accurate results

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.
📢 Have feedback on the report? Share it here.

@zombieJ zombieJ merged commit 26dd154 into react-component:master Feb 5, 2024
9 checks passed
// The best way is to use ResizeObserver to detect the body height, but this way is enough
React.useEffect(() => {
checkScrollBarVisible();
}, [data]);
Copy link
Member

@afc163 afc163 Feb 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data 放这里很容易触发的,如果写成字面量对象的。

改成 data.length 是不是就够了?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个方式已经很保守了,你说的这个,比如切换分页时,新的文本可能很长跟原来的差很多可能就有问题了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants