Skip to content

Commit 26a579b

Browse files
committed
fix(hydration): handle transition appear hydration edge case
1 parent 163b365 commit 26a579b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/runtime-core/src/hydration.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,10 @@ export function createHydrationFunctions(
398398
parentComponent.vnode.props.appear
399399

400400
const content = (el as HTMLTemplateElement).content
401-
.firstChild as Element
401+
.firstChild as Element & { $cls: string | null }
402402

403403
if (needCallTransitionHooks) {
404+
content.$cls = content.getAttribute('class')
404405
transition!.beforeEnter(content)
405406
}
406407

@@ -786,7 +787,7 @@ export function createHydrationFunctions(
786787
* Dev only
787788
*/
788789
function propHasMismatch(
789-
el: Element,
790+
el: Element & { $cls?: string | null },
790791
key: string,
791792
clientValue: any,
792793
vnode: VNode,
@@ -799,7 +800,7 @@ function propHasMismatch(
799800
if (key === 'class') {
800801
// classes might be in different order, but that doesn't affect cascade
801802
// so we just need to check if the class lists contain the same classes.
802-
actual = el.getAttribute('class')
803+
actual = el.$cls || el.getAttribute('class')
803804
expected = normalizeClass(clientValue)
804805
if (!isSetEqual(toClassSet(actual || ''), toClassSet(expected))) {
805806
mismatchType = MismatchTypes.CLASS

0 commit comments

Comments
 (0)