Commit ca49622c authored by Chunchi Che's avatar Chunchi Che

fix removeChild crash

parent 766e285b
......@@ -22,7 +22,10 @@ export const withPortalToBody = <P extends object>(
return () => {
// 卸载组件并且移除容器
setTimeout(() => root.unmount());
portalRoot.removeChild(newNode);
if (portalRoot.contains(newNode)) {
// 做个if判断,防止下面这行crash
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