fix(Teleport): fallback to non-optimized mode when HRM performing updates (#3311)

fix #3302
This commit is contained in:
HcySunYang
2021-03-27 02:02:44 +08:00
committed by GitHub
parent 8c3c14a0ff
commit 9cb21d088e
2 changed files with 69 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ import {
import { VNode, VNodeArrayChildren, VNodeProps } from '../vnode'
import { isString, ShapeFlags } from '@vue/shared'
import { warn } from '../warning'
import { isHmrUpdating } from '../hmr'
export type TeleportVNode = VNode<RendererNode, RendererElement, TeleportProps>
@@ -85,6 +86,13 @@ export const TeleportImpl = {
const disabled = isTeleportDisabled(n2.props)
const { shapeFlag, children } = n2
// #3302
// HMR updated, force full diff
if (__DEV__ && isHmrUpdating) {
optimized = false
n2.dynamicChildren = null
}
if (n1 == null) {
// insert anchors in the main view
const placeholder = (n2.el = __DEV__