fix(teleport): should only force remove teleport when not disabled
fix #2323
This commit is contained in:
parent
54ed7592e4
commit
b0931dcaba
@ -20,7 +20,7 @@ export interface TeleportProps {
|
|||||||
|
|
||||||
export const isTeleport = (type: any): boolean => type.__isTeleport
|
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 === '')
|
props && (props.disabled || props.disabled === '')
|
||||||
|
|
||||||
const resolveTarget = <T = RendererElement>(
|
const resolveTarget = <T = RendererElement>(
|
||||||
|
@ -56,7 +56,11 @@ import {
|
|||||||
queueEffectWithSuspense,
|
queueEffectWithSuspense,
|
||||||
SuspenseImpl
|
SuspenseImpl
|
||||||
} from './components/Suspense'
|
} from './components/Suspense'
|
||||||
import { TeleportImpl, TeleportVNode } from './components/Teleport'
|
import {
|
||||||
|
isTeleportDisabled,
|
||||||
|
TeleportImpl,
|
||||||
|
TeleportVNode
|
||||||
|
} from './components/Teleport'
|
||||||
import { isKeepAlive, KeepAliveContext } from './components/KeepAlive'
|
import { isKeepAlive, KeepAliveContext } from './components/KeepAlive'
|
||||||
import { registerHMR, unregisterHMR, isHmrUpdating } from './hmr'
|
import { registerHMR, unregisterHMR, isHmrUpdating } from './hmr'
|
||||||
import {
|
import {
|
||||||
@ -2037,8 +2041,11 @@ function baseCreateRenderer(
|
|||||||
unmountChildren(children as VNode[], parentComponent, parentSuspense)
|
unmountChildren(children as VNode[], parentComponent, parentSuspense)
|
||||||
}
|
}
|
||||||
|
|
||||||
// an unmounted teleport should always remove its children
|
// an unmounted teleport should always remove its children if not disabled
|
||||||
if (shapeFlag & ShapeFlags.TELEPORT) {
|
if (
|
||||||
|
shapeFlag & ShapeFlags.TELEPORT &&
|
||||||
|
(doRemove || !isTeleportDisabled(vnode.props))
|
||||||
|
) {
|
||||||
;(vnode.type as typeof TeleportImpl).remove(vnode, internals)
|
;(vnode.type as typeof TeleportImpl).remove(vnode, internals)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user