fix(compiler-core): should generate HYDRATE_EVENTS flag on dynamic component that resolves to element

fix #5870
This commit is contained in:
Evan You
2022-05-17 16:39:48 +08:00
parent f811dc2b60
commit 415091b0ee
5 changed files with 45 additions and 6 deletions

View File

@@ -34,7 +34,8 @@ import {
TRANSITION_GROUP,
CREATE_VNODE,
CallExpression,
JSChildNode
JSChildNode,
RESOLVE_DYNAMIC_COMPONENT
} from '@vue/compiler-dom'
import { SSR_RENDER_COMPONENT, SSR_RENDER_VNODE } from '../runtimeHelpers'
import {
@@ -83,6 +84,8 @@ export const ssrTransformComponent: NodeTransform = (node, context) => {
}
const component = resolveComponentType(node, context, true /* ssr */)
const isDynamicComponent =
isObject(component) && component.callee === RESOLVE_DYNAMIC_COMPONENT
componentTypeMap.set(node, component)
if (isSymbol(component)) {
@@ -116,7 +119,13 @@ export const ssrTransformComponent: NodeTransform = (node, context) => {
if (node.props.length) {
// note we are not passing ssr: true here because for components, v-on
// handlers should still be passed
const { props, directives } = buildProps(node, context)
const { props, directives } = buildProps(
node,
context,
undefined,
true,
isDynamicComponent
)
if (props || directives.length) {
propsExp = buildSSRProps(props, directives, context)
}

View File

@@ -89,6 +89,8 @@ export const ssrTransformElement: NodeTransform = (node, context) => {
node,
context,
node.props,
false /* isComponent */,
false /* isDynamicComponent */,
true /* ssr */
)
if (props || directives.length) {