Skip to content

Commit b7ecc3c

Browse files
committed
refactor: optimize functional component logic
1 parent 1bac7fb commit b7ecc3c

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/mount.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,8 @@ export function mount(
233233
let component
234234

235235
if (isFunctionalComponent(originalComponent)) {
236-
// we need to wrap it like this so we can capture emitted events.
237-
// we capture events using a mixin that mutates `emit` in `beforeCreate`,
238-
// but functional components do not support mixins, so we need to wrap it
239-
// and make it a non-functional component for testing purposes.
240236
component = defineComponent({
241-
setup: (_, { attrs, slots, emit }) => () => {
242-
return h((props: any, ctx: any) =>
243-
originalComponent(props, { ...ctx, ...attrs, emit, slots })
244-
)
245-
}
237+
setup: (_, { attrs, slots }) => () => h(originalComponent, attrs, slots)
246238
})
247239
} else if (isObjectComponent(originalComponent)) {
248240
component = { ...originalComponent }

0 commit comments

Comments
 (0)