export const isTeleport = (type: any): boolean => type.__isTeleport
-const isTeleportDisabled = (props: VNode['props']): boolean =>
+export const isTeleportDisabled = (props: VNode['props']): boolean =>
props && (props.disabled || props.disabled === '')
const resolveTarget = <T = RendererElement>(
queueEffectWithSuspense,
SuspenseImpl
} from './components/Suspense'
-import { TeleportImpl, TeleportVNode } from './components/Teleport'
+import {
+ isTeleportDisabled,
+ TeleportImpl,
+ TeleportVNode
+} from './components/Teleport'
import { isKeepAlive, KeepAliveContext } from './components/KeepAlive'
import { registerHMR, unregisterHMR, isHmrUpdating } from './hmr'
import {
unmountChildren(children as VNode[], parentComponent, parentSuspense)
}
- // an unmounted teleport should always remove its children
- if (shapeFlag & ShapeFlags.TELEPORT) {
+ // an unmounted teleport should always remove its children if not disabled
+ if (
+ shapeFlag & ShapeFlags.TELEPORT &&
+ (doRemove || !isTeleportDisabled(vnode.props))
+ ) {
;(vnode.type as typeof TeleportImpl).remove(vnode, internals)
}