-
-
Notifications
You must be signed in to change notification settings - Fork 200
fix: afterClose unexpected call when mount dialog #244
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
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/react-component/dialog/7rtX76vT2chf3Ty5aToTZiXNUioi |
@@ -81,7 +81,10 @@ export default function Dialog(props: IDialogChildProps) { | |||
lastOutSideActiveElementRef.current = null; | |||
} | |||
|
|||
afterClose?.(); | |||
// Trigger afterClose only when change visible from true to false | |||
if (animatedVisible) { |
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.
只有当 visible 从 true 变为 false 时才触发,避免 mount 时直接触发 afterClose。
这里拿不到 prevVisible,有个 animatedVisible 测试起来貌似可用。
@zombieJ 和 @shaodahong 帮忙确认一下。
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.
上面 73 行设为 false 了,会出现 true 的情况吗?
Codecov Report
@@ Coverage Diff @@
## master #244 +/- ##
==========================================
+ Coverage 98.11% 98.12% +0.01%
==========================================
Files 6 6
Lines 159 160 +1
Branches 46 47 +1
==========================================
+ Hits 156 157 +1
Misses 2 2
Partials 1 1
Continue to review full report at Codecov.
|
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.
看了下可以
@afc163 这个没问题可以合了。 |
记录一下原因:
|
close ant-design/ant-design#29009