-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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(Popover): autoUpdate not working when defaultVisible is false #6795
Conversation
Deploying ant-design-mobile with Cloudflare Pages
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6795 +/- ##
=======================================
Coverage 92.72% 92.72%
=======================================
Files 335 335
Lines 7198 7198
Branches 1804 1767 -37
=======================================
Hits 6674 6674
- Misses 489 516 +27
+ Partials 35 8 -27 ☔ View full report in Codecov by Sentry. |
Size Change: -18 B (0%) Total Size: 370 kB
ℹ️ View Unchanged
|
size-limit report 📦
|
@@ -187,11 +187,11 @@ export const Popover = forwardRef<PopoverRef, PopoverProps>((p, ref) => { | |||
|
|||
useEffect(() => { | |||
const floatingElement = floatingRef.current | |||
if (!targetElement || !floatingElement) return | |||
if (!targetElement || !floatingElement || !visible) return |
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.
之前的代码也有 elementResize 为什么会没效果?
autoUpdate 在 visible 变化时触发,visible 为 false 关闭 autoUpdate,visible 为 true 开启 autoUpdate。一方面可以优化运行时性能,另一方面可以解决默认 visible = false 时,元素未创建,导致 autoUpdate 不生效的问题。
Fix #6794