mirror of https://github.com/vuejs/core.git
perf: reuse currentHydrationNode when possible
This commit is contained in:
parent
ba48c8ab57
commit
12d5bb5653
|
@ -157,7 +157,11 @@ function locateHydrationNodeImpl(): void {
|
||||||
// prepend
|
// prepend
|
||||||
if (insertionAnchor === 0) {
|
if (insertionAnchor === 0) {
|
||||||
// use prevDynamicCount as logical index to locate the hydration node
|
// use prevDynamicCount as logical index to locate the hydration node
|
||||||
node = locateChildByLogicalIndex(insertionParent!, prevDynamicCount)!
|
node =
|
||||||
|
prevDynamicCount === 0 &&
|
||||||
|
currentHydrationNode!.parentNode === insertionParent
|
||||||
|
? currentHydrationNode
|
||||||
|
: locateChildByLogicalIndex(insertionParent!, prevDynamicCount)!
|
||||||
}
|
}
|
||||||
// insert
|
// insert
|
||||||
else if (insertionAnchor instanceof Node) {
|
else if (insertionAnchor instanceof Node) {
|
||||||
|
@ -188,7 +192,10 @@ function locateHydrationNodeImpl(): void {
|
||||||
node = locateChildByLogicalIndex(insertionParent!, appendIndex + 1)!
|
node = locateChildByLogicalIndex(insertionParent!, appendIndex + 1)!
|
||||||
} else {
|
} else {
|
||||||
if (insertionAnchor === null) {
|
if (insertionAnchor === null) {
|
||||||
node = locateChildByLogicalIndex(insertionParent!, 0)!
|
node =
|
||||||
|
currentHydrationNode!.parentNode === insertionParent
|
||||||
|
? currentHydrationNode
|
||||||
|
: locateChildByLogicalIndex(insertionParent!, 0)!
|
||||||
} else {
|
} else {
|
||||||
node = locateChildByLogicalIndex(
|
node = locateChildByLogicalIndex(
|
||||||
insertionParent!,
|
insertionParent!,
|
||||||
|
|
Loading…
Reference in New Issue