fix(suspence): fix newBranch shapeFlag not reset under hmr

This commit is contained in:
yangchangtao 2025-03-20 20:09:21 +08:00
parent 119f18c773
commit d2e2a192ef
1 changed files with 3 additions and 3 deletions

View File

@ -235,7 +235,7 @@ function patchSuspense(
const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense
if (pendingBranch) { if (pendingBranch) {
suspense.pendingBranch = newBranch suspense.pendingBranch = newBranch
if (isSameVNodeType(newBranch, pendingBranch)) { if (isSameVNodeType(pendingBranch, newBranch)) {
// same root type but content may have changed. // same root type but content may have changed.
patch( patch(
pendingBranch, pendingBranch,
@ -321,7 +321,7 @@ function patchSuspense(
) )
setActiveBranch(suspense, newFallback) setActiveBranch(suspense, newFallback)
} }
} else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) { } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
// toggled "back" to current active branch // toggled "back" to current active branch
patch( patch(
activeBranch, activeBranch,
@ -355,7 +355,7 @@ function patchSuspense(
} }
} }
} else { } else {
if (activeBranch && isSameVNodeType(newBranch, activeBranch)) { if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
// root did not change, just normal patch // root did not change, just normal patch
patch( patch(
activeBranch, activeBranch,