fix(ssr): fix hydration error on falsy v-if inside transition/keep-alive

fix #5352
This commit is contained in:
Evan You
2022-05-18 09:28:18 +08:00
parent c65b805ef1
commit ee4186ef9e
11 changed files with 119 additions and 53 deletions

View File

@@ -84,5 +84,9 @@ export function ssrRenderSlotInner(
const commentRE = /<!--.*?-->/g
function isComment(item: SSRBufferItem) {
return typeof item === 'string' && !item.replace(commentRE, '').trim()
return (
typeof item === 'string' &&
commentRE.test(item) &&
!item.replace(commentRE, '').trim()
)
}