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: Popconfirm onVisibleChange trigger twice #42393

Merged
merged 3 commits into from
May 16, 2023
Merged

fix: Popconfirm onVisibleChange trigger twice #42393

merged 3 commits into from
May 16, 2023

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented May 16, 2023

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Other (about what?)

🔗 Related issue link

fix #42314
ref #42351

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English Fix Popconfirm trigger onVisibleChange twice.
🇨🇳 Chinese 修复 Popconfirm 的 onVisibleChange 会重复触发的问题。

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

🤖 Generated by Copilot at bda5438

Refactor and test the Popconfirm component. Improve the code style and readability of components/popconfirm/__tests__/index.test.tsx and components/popconfirm/index.tsx. Ensure backward compatibility with the onVisibleChange prop.

🔍 Walkthrough

🤖 Generated by Copilot at bda5438

  • Simplify props destructuring and assign default values in Popconfirm component (link)
  • Support legacy prop onVisibleChange and trigger it along with onOpenChange in handleVisibleChange function (link)
  • Rename onOpenChange function to onInternalOpenChange and remove props destructuring from it (link, link)
  • Replace onOpenChange prop with onInternalOpenChange function in Popover component (link)
  • Replace double quotes with single quotes in test cases to follow code style (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Add test case to check that onVisibleChange is only triggered once when popconfirm is opened or closed (link)

@github-actions
Copy link
Contributor

github-actions bot commented May 16, 2023

@github-actions
Copy link
Contributor

github-actions bot commented May 16, 2023

size-limit report 📦

Path Size
./dist/antd.min.js 384.29 KB (+20 B 🔺)
./dist/antd-with-locales.min.js 443.54 KB (+20 B 🔺)

@codecov
Copy link

codecov bot commented May 16, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (75e4099) 99.99% compared to head (bda5438) 99.99%.

❗ Current head bda5438 differs from pull request most recent head 1dda000. Consider uploading reports for the commit 1dda000 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #42393   +/-   ##
=======================================
  Coverage   99.99%   99.99%           
=======================================
  Files         640      640           
  Lines       10838    10839    +1     
  Branches     2944     2944           
=======================================
+ Hits        10837    10838    +1     
  Misses          1        1           
Impacted Files Coverage Δ
components/popconfirm/index.tsx 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@zombieJ zombieJ merged commit cd71f19 into master May 16, 2023
86 checks passed
@zombieJ zombieJ deleted the fix-popconfirm branch May 16, 2023 07:40
@MadCcc MadCcc mentioned this pull request May 22, 2023
20 tasks
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.

Popconfirm 使用 visible & onVisibleChange 出现一次点击 onConfirm 方法被调用两次
3 participants