fix: sync controlled scrollbar visibility - #382
Conversation
|
@nrps9909 is attempting to deploy a commit to the afc163's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review. Walkthrough本次变更更新 Changes滚动条可见性
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change synchronizes scrollbar visibility when the controlling prop changes while preserving delayed hiding for optional mode. The behavior is covered by regression tests and no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files. ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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. Comment |
Summary
showScrollBarchangesoptionalProblem
showScrollBarcurrently initializesvisible, but later boolean prop changes never update that state. A list rendered withshowScrollBar={false}therefore stays hidden after changing totrue, and the reverse transition can stay visible.Testing
a573364: afterfalse -> true, the vertical scrollbar still lacked its visible classfalse -> true -> false -> optional, including the existing three-second optional hidenpm test -- tests/scroll.test.js --runInBand(38 passed)npm test -- --runInBand(8 suites, 281 tests passed)npm run tscnpm run lint(0 errors; 13 pre-existing hook warnings, down from 14 because the timer callback is now stable)npm run compile(ESM, CJS, and declarations)git diff --checkOverlap audit
PR #381 touches the same source and test files, but only the non-primary mouse-button handlers and their separate regression. The visibility changes here are in independent hunks. The older #158 visibility proposal is a conflicting 2021 branch for adding an always-visible API; the current public
showScrollBarAPI already exists and this PR fixes its controlled rerender behavior. Broad conflicting PR #199 does not cover prop synchronization.AI assistance disclosure: Codex was used to trace the controlled-prop lifecycle, implement and validate the exact-base regression and timer behavior, audit open PR overlap, and draft this PR. All stated behavior and test results were verified locally.
Summary by CodeRabbit
Bug 修复
测试