fix(Teleport): avoid changing the reference of vnode.dynamicChildren (#3642)

fix #3641
This commit is contained in:
HcySunYang 2021-05-08 06:04:36 +08:00 committed by GitHub
parent e7300eb479
commit 43f78151bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,13 +84,13 @@ export const TeleportImpl = {
} = internals } = internals
const disabled = isTeleportDisabled(n2.props) const disabled = isTeleportDisabled(n2.props)
const { shapeFlag, children } = n2 let { shapeFlag, children, dynamicChildren } = n2
// #3302 // #3302
// HMR updated, force full diff // HMR updated, force full diff
if (__DEV__ && isHmrUpdating) { if (__DEV__ && isHmrUpdating) {
optimized = false optimized = false
n2.dynamicChildren = null dynamicChildren = null
} }
if (n1 == null) { if (n1 == null) {
@ -146,11 +146,11 @@ export const TeleportImpl = {
const currentAnchor = wasDisabled ? mainAnchor : targetAnchor const currentAnchor = wasDisabled ? mainAnchor : targetAnchor
isSVG = isSVG || isTargetSVG(target) isSVG = isSVG || isTargetSVG(target)
if (n2.dynamicChildren) { if (dynamicChildren) {
// fast path when the teleport happens to be a block root // fast path when the teleport happens to be a block root
patchBlockChildren( patchBlockChildren(
n1.dynamicChildren!, n1.dynamicChildren!,
n2.dynamicChildren, dynamicChildren,
currentContainer, currentContainer,
parentComponent, parentComponent,
parentSuspense, parentSuspense,