-
-
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:doesn't scroll when use scrollTo with top
zero
#1180
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
补一个测试用例。 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1180 +/- ##
=======================================
Coverage 97.70% 97.70%
=======================================
Files 75 75
Lines 7402 7416 +14
Branches 1109 1110 +1
=======================================
+ Hits 7232 7246 +14
Misses 164 164
Partials 6 6 ☔ View full report in Codecov by Sentry. |
…into fix/scrollbehavior
@@ -332,7 +332,8 @@ function Table<RecordType extends DefaultRecordType>( | |||
// Native scroll | |||
const { index, top, key } = config; | |||
|
|||
if (top) { | |||
// * 考虑top为0的情况 | |||
if (top || top === 0) { |
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.
逻辑不太清晰,不能依靠注释来解释逻辑,我的建议是写一个方法判断:
function isVerifyValue(value: any) {
return typeof value === "number" && !Number.isNaN(value);
}
if (isValidValue(top)) {
scrollBodyRef.current?.scrollTo({ top });
}
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.
ant-design/ant-design#50547