Skip to content

Commit

Permalink
fix(antd/next): remove host element after unmount in portal (#2900)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouxinyong authored Mar 3, 2022
1 parent 1ef47b0 commit a2af5c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/antd/src/__builtins__/portal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export function createPortalRoot<T extends React.ReactNode>(
function unmount() {
if (PortalMap.has(id)) {
PortalMap.set(id, null)
} else if (host) {
}
if (host) {
ReactDOM.unmountComponentAtNode(host)
host.parentNode?.removeChild(host)
}
Expand Down
3 changes: 2 additions & 1 deletion packages/next/src/__builtins__/portal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export function createPortalRoot<T extends React.ReactNode>(
function unmount() {
if (PortalMap.has(id)) {
PortalMap.set(id, null)
} else if (host) {
}
if (host) {
ReactDOM.unmountComponentAtNode(host)
host.parentNode?.removeChild(host)
}
Expand Down

0 comments on commit a2af5c9

Please sign in to comment.