chore: update

This commit is contained in:
daiwei 2025-02-01 11:37:03 +08:00
parent 913af4c543
commit b7e11639d5
1 changed files with 11 additions and 7 deletions

View File

@ -19,6 +19,7 @@ import {
ShapeFlags, ShapeFlags,
def, def,
getEscapedCssVarName, getEscapedCssVarName,
hasOwn,
includeBooleanAttr, includeBooleanAttr,
isBooleanAttr, isBooleanAttr,
isKnownHtmlAttr, isKnownHtmlAttr,
@ -677,7 +678,7 @@ export function createHydrationFunctions(
): Node | null => { ): Node | null => {
if ( if (
!isMismatchAllowed(node.parentElement!, MismatchTypes.CHILDREN) && !isMismatchAllowed(node.parentElement!, MismatchTypes.CHILDREN) &&
!isCommentNodeMismatch(node, vnode) !isMismatchAllowedForCommentNode(node, vnode)
) { ) {
;(__DEV__ || __FEATURE_PROD_HYDRATION_MISMATCH_DETAILS__) && ;(__DEV__ || __FEATURE_PROD_HYDRATION_MISMATCH_DETAILS__) &&
warn( warn(
@ -998,10 +999,13 @@ function isMismatchAllowed(
} }
// data-allow-mismatch + v-if // data-allow-mismatch + v-if
function isCommentNodeMismatch(node: Node, vnode: VNode): boolean { function isMismatchAllowedForCommentNode(
if (node.nodeType !== DOMNodeTypes.COMMENT || !vnode.props) { node: Node,
return false { props }: VNode,
} ): boolean {
return (
return allowMismatchAttr in vnode.props node.nodeType === DOMNodeTypes.COMMENT &&
props != null &&
hasOwn(props, allowMismatchAttr)
)
} }