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

react-dom挂载的组件没有销毁实例 #710

Closed
xty1992a opened this issue Jul 8, 2021 · 3 comments
Closed

react-dom挂载的组件没有销毁实例 #710

xty1992a opened this issue Jul 8, 2021 · 3 comments
Assignees
Labels
🐞 bug 漏洞

Comments

@xty1992a
Copy link

xty1992a commented Jul 8, 2021

Description

多次Modal.confirm等方法,关闭后实例并未销毁
image
检查源码发现只卸载了dom,没有销毁实例
image

Steps to Reproduce

  1. 多次调用Modal.confirm
  2. 检查react-devtools,会发现多个实例

Error Trace (if possible)

It's better to post up the error stack for us to trace this issue.

Solution

What needs to be done to address this issue? Ideally, provide a pull request with a fix.

Environment

zarm 2.9.3
react/react-native 17.0.2
system win10
browser chrome

@xty1992a
Copy link
Author

xty1992a commented Jul 8, 2021

使用unmountComponentAtNode方法销毁实例.

组件不销毁除了占用内存外,还导致组件内useEffect的清理回调无法执行.
测试用例可以通过这点来验证

@xty1992a
Copy link
Author

@JeromeLin
confirm的问题修复了,但类似的其他场景没有修复,比如loading,toast等

搜索ReactDOM.render可以发下如下地方使用.这个api应该是两两对应的
image

@JeromeLin
Copy link
Collaborator

@xty1992a 感谢反馈,已修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug 漏洞
Projects
None yet
Development

No branches or pull requests

3 participants