Skip to content

Commit a2af5c9

Browse files
authored
fix(antd/next): remove host element after unmount in portal (#2900)
1 parent 1ef47b0 commit a2af5c9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/antd/src/__builtins__/portal.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ export function createPortalRoot<T extends React.ReactNode>(
4949
function unmount() {
5050
if (PortalMap.has(id)) {
5151
PortalMap.set(id, null)
52-
} else if (host) {
52+
}
53+
if (host) {
5354
ReactDOM.unmountComponentAtNode(host)
5455
host.parentNode?.removeChild(host)
5556
}

packages/next/src/__builtins__/portal.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ export function createPortalRoot<T extends React.ReactNode>(
4949
function unmount() {
5050
if (PortalMap.has(id)) {
5151
PortalMap.set(id, null)
52-
} else if (host) {
52+
}
53+
if (host) {
5354
ReactDOM.unmountComponentAtNode(host)
5455
host.parentNode?.removeChild(host)
5556
}

0 commit comments

Comments
 (0)