Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/runtime-vapor/src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ export function createComponent(
locateHydrationNode()
}

const isFnComponent = isFunction(component)
// vdom interop enabled and component is not an explicit vapor component
if (appContext.vapor && !component.__vapor) {
if (appContext.vapor && !isFnComponent && !component.__vapor) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to distinguish whether a functional component is a vdom component or a vapor component

const frag = appContext.vapor.vdomMount(
component as any,
rawProps,
Expand Down Expand Up @@ -199,7 +200,7 @@ export function createComponent(
setupPropsValidation(instance)
}

const setupFn = isFunction(component) ? component : component.setup
const setupFn = isFnComponent ? component : component.setup
const setupResult = setupFn
? callWithErrorHandling(setupFn, instance, ErrorCodes.SETUP_FUNCTION, [
instance.props,
Expand All @@ -208,7 +209,7 @@ export function createComponent(
: EMPTY_OBJ

if (__DEV__ && !isBlock(setupResult)) {
if (isFunction(component)) {
if (isFnComponent) {
warn(`Functional vapor component must return a block directly.`)
instance.block = []
} else if (!component.render) {
Expand Down