perf: skip patch on same vnode
This commit is contained in:
parent
dd1439e711
commit
d13774b881
@ -470,6 +470,10 @@ function baseCreateRenderer(
|
||||
slotScopeIds = null,
|
||||
optimized = __DEV__ && isHmrUpdating ? false : !!n2.dynamicChildren
|
||||
) => {
|
||||
if (n1 === n2) {
|
||||
return
|
||||
}
|
||||
|
||||
// patching & not same type, unmount old tree
|
||||
if (n1 && !isSameVNodeType(n1, n2)) {
|
||||
anchor = getNextHostNode(n1)
|
||||
@ -1152,8 +1156,12 @@ function baseCreateRenderer(
|
||||
const fragmentEndAnchor = (n2.anchor = n1 ? n1.anchor : hostCreateText(''))!
|
||||
|
||||
let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2
|
||||
if (dynamicChildren) {
|
||||
optimized = true
|
||||
|
||||
if (__DEV__ && isHmrUpdating) {
|
||||
// HMR updated, force full diff
|
||||
patchFlag = 0
|
||||
optimized = false
|
||||
dynamicChildren = null
|
||||
}
|
||||
|
||||
// check if this is a slot fragment with :slotted scope ids
|
||||
@ -1163,13 +1171,6 @@ function baseCreateRenderer(
|
||||
: fragmentSlotScopeIds
|
||||
}
|
||||
|
||||
if (__DEV__ && isHmrUpdating) {
|
||||
// HMR updated, force full diff
|
||||
patchFlag = 0
|
||||
optimized = false
|
||||
dynamicChildren = null
|
||||
}
|
||||
|
||||
if (n1 == null) {
|
||||
hostInsert(fragmentStartAnchor, container, anchor)
|
||||
hostInsert(fragmentEndAnchor, container, anchor)
|
||||
|
Loading…
Reference in New Issue
Block a user