-
Notifications
You must be signed in to change notification settings - Fork 163
fix: Dynamic height bump the scroll pos in some edge case #309
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Walkthrough本次更改修正了虚拟列表在行高变更时的滚动同步逻辑。主要调整包括:在缓存高度变更记录时,改用 Map 存储变更前的值,并在滚动同步时准确获取变更项及其旧值,避免在有旧高度缓存时错误地调整滚动条。同时,测试用例也进行了相应增强。 Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant List
participant CacheMap
User->>List: 展开/收起首行详情
List->>CacheMap: 记录高度变更及旧值
List->>List: useLayoutEffect 检查变更记录
alt 有变更项且无旧缓存
List->>List: 计算高度差并调整 scrollTop
else 有旧缓存
List->>List: 不调整 scrollTop
end
Assessment against linked issues
Possibly related PRs
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
tests/scroll.test.jsOops! Something went wrong! :( ESLint: 8.57.1 Error: Cannot read config file: /.eslintrc.js
src/utils/CacheMap.tsOops! Something went wrong! :( ESLint: 8.57.1 Error: Cannot read config file: /.eslintrc.js
src/List.tsxOops! Something went wrong! :( ESLint: 8.57.1 Error: Cannot read config file: /.eslintrc.js
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🔇 Additional comments (8)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #309 +/- ##
==========================================
+ Coverage 97.27% 97.64% +0.37%
==========================================
Files 19 19
Lines 807 808 +1
Branches 191 195 +4
==========================================
+ Hits 785 789 +4
+ Misses 22 19 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fix ant-design/ant-design#53334
close react-component/table#1256
When the Item has already record the height (for height change), the auto scroll patch offset should skip to avoid jump.
Summary by CodeRabbit
Bug Fixes
Tests