Skip to content
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

Merged
merged 1 commit into from
Dec 14, 2024

Conversation

guoyunhe
Copy link
Contributor

autoUpdate 在 visible 变化时触发,visible 为 false 关闭 autoUpdate,visible 为 true 开启 autoUpdate。一方面可以优化运行时性能,另一方面可以解决默认 visible = false 时,元素未创建,导致 autoUpdate 不生效的问题。

Fix #6794

Copy link
Contributor

github-actions bot commented Dec 10, 2024

Preview is ready

Copy link

Deploying ant-design-mobile with  Cloudflare Pages  Cloudflare Pages

Latest commit: 679e974
Status: ✅  Deploy successful!
Preview URL: https://4fc2ec97.ant-design-mobile.pages.dev
Branch Preview URL: https://popover-dynamic.ant-design-mobile.pages.dev

View logs

Copy link

codecov bot commented Dec 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.72%. Comparing base (495be63) to head (679e974).

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.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

Size Change: -18 B (0%)

Total Size: 370 kB

Filename Size Change
./lib/bundle/antd-mobile.compatible.umd.js 198 kB -25 B (-0.01%)
./lib/bundle/antd-mobile.umd.js 152 kB +7 B (0%)
ℹ️ View Unchanged
Filename Size
./lib/bundle/css-vars-patch.css 1.63 kB
./lib/bundle/style.css 18.5 kB

compressed-size-action

Copy link
Contributor

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
./lib/bundle/antd-mobile.es.js 107.76 KB (+138 B 🔺) 2.2 s (+0.13% 🔺) 1.1 s (+2.08% 🔺) 3.3 s

@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之前的代码也有 elementResize 为什么会没效果?

@guoyunhe guoyunhe merged commit 8407aae into master Dec 14, 2024
14 checks passed
@guoyunhe guoyunhe deleted the popover-dynamic branch December 14, 2024 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Popover 内容高度变化时,无法重新定位
2 participants