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