-
-
Notifications
You must be signed in to change notification settings - Fork 326
fix: arrow position retry #909
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该变更涉及两个主要部分。首先,在 Changes
Sequence Diagram(s)sequenceDiagram
participant Popup
participant Effect
Popup->>Effect: activeInputLeft 变化
Effect->>Popup: 设置 retryTimes = 10
alt wrapperRect 高度为 0 或右边界小于 0
Effect-->>Popup: 递减 retryTimes
else 尺寸有效
Effect->>Popup: 保持当前 retryTimes 值
end
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/range.spec.tsxOops! Something went wrong! :( ESLint: 8.57.1 Error: Cannot read config file: /.eslintrc.js
src/PickerInput/Popup/index.tsxOops! Something went wrong! :( ESLint: 8.57.1 Error: Cannot read config file: /.eslintrc.js
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/PickerInput/Popup/index.tsx (2)
105-109
: 在使用 state 管理重试次数时需考虑重复渲染的影响。
当activeInputLeft
变化时,将retryTimes
重置为10
,可能导致 effect 多次触发并造成不必要的重复渲染。可考虑在逻辑上增加额外条件或限制,避免性能压力。
141-141
: 将retryTimes
添加到依赖列表可使布局重试不断进行,但也会增加渲染次数。
每次重试都会再次执行该 effect。虽然有上限,但请确保不会带来明显的性能开销或影响用户体验。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
tests/__snapshots__/range.spec.tsx.snap
is excluded by!**/*.snap
📒 Files selected for processing (2)
src/PickerInput/Popup/index.tsx
(3 hunks)tests/range.spec.tsx
(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: ✅ test
tests/range.spec.tsx
[error] 1917-1917: Snapshot test failed for 'Picker.Range use dateRender and monthCellRender in month range picker'.
[error] 1929-1929: Snapshot test failed for 'Picker.Range use dateRender and monthCellRender in date range picker'.
🔇 Additional comments (2)
tests/range.spec.tsx (1)
1835-1835
: 在单元测试中强制设置height=1
可能导致快照不一致。
此处会让模拟的组件高度固定为 1,可能与真实场景下的样式或布局不匹配,从而导致 snapshot 测试失败。建议确认是否需要更新测试快照或使用更具代表性的模拟值。src/PickerInput/Popup/index.tsx (1)
120-124
: 通过递减retryTimes
进行布局重试的逻辑可行,但需避免无效循环。
在获取不到有效wrapperRect
时递减重试次数并中断,会再次触发 effect。建议确认在实际场景中能满足预期需求,并避免一直无法获取有效矩形时的死循环或错误状态。
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #909 +/- ##
=======================================
Coverage 98.71% 98.71%
=======================================
Files 64 64
Lines 2646 2652 +6
Branches 735 736 +1
=======================================
+ Hits 2612 2618 +6
Misses 31 31
Partials 3 3 ☔ View full report in Codecov by Sentry. |
ref ant-design/ant-design#52851
Summary by CodeRabbit