-
Notifications
You must be signed in to change notification settings - Fork 105
fix: should not render when showProp is false #31
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
|
Add a test. |
|
https://github.com/react-component/m-dialog/blob/master/src/DialogWrap.tsx#L27 rmc-dialog 会在 unmount 的时候尝试关闭 modal, 反而触发 animate 渲染流程。 导致的 bug 是在单页应用,B 页面的 Modal 在返回到 A 页面时候显示出来 |
|
cc @zhang740 |
这本来应该是 feature,unmount 的时候也会触发动画。 |
|
对,但 showProp 的值此时是 false, 内容不应该渲染出来。 |
|
https://github.com/react-component/dialog/blob/master/src/DialogWrap.tsx#L48 要在动画结束的时候移除 container。 |
|
在 rmc-dialog 层面也能修复 @silentcloud 看下 我先写个只用 rc-animate 复现的情况 |
这个是做了的 https://github.com/react-component/m-dialog/blob/master/src/DialogWrap.tsx#L41 |
原来的逻辑,如果直接 component unmount 就 remove 的话 preact 下有问题 |
|
@silentcloud 意思是 rc-dialog 的做法在 preact 下会有问题吗? |
|
@yesmeck 嗯 |
|
@yesmeck review一下? |
| </Component>); | ||
| }); | ||
|
|
||
| describe('when initial', () => { |
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.
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.
跟测试用例的流程是一样的
|
感觉是 breaking change。现在 rc-dialog 就需要在 |
|
那就在 rmc-dialog 层面修复,state 里面记录当前的 visible 状态,componentWillUnmount 的时候不要盲目尝试 renderComponent(false) 条件判断一下 cc @zhang740 @silentcloud |
|
@paranoidjk componentWillUnmount 如果不 render false,preact 下关闭的时候动画就没了 |
|
@silentcloud 是条件判断。如果当前就是 visible: false 的,componentWillUnmount 为啥还要 render false? |
|
@paranoidjk 哦,理解错误,这个情况是👌 的 |
No description provided.