Commit 551fc976 authored by Chunchi Che's avatar Chunchi Che

Merge branch 'fix/crash' into 'main'

fix removeChild crash

See merge request !314
parents 766e285b ca49622c
...@@ -22,7 +22,10 @@ export const withPortalToBody = <P extends object>( ...@@ -22,7 +22,10 @@ export const withPortalToBody = <P extends object>(
return () => { return () => {
// 卸载组件并且移除容器 // 卸载组件并且移除容器
setTimeout(() => root.unmount()); setTimeout(() => root.unmount());
if (portalRoot.contains(newNode)) {
// 做个if判断,防止下面这行crash
portalRoot.removeChild(newNode); portalRoot.removeChild(newNode);
}
}; };
}, []); }, []);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment