Skip to content

Commit 17de0a2

Browse files
Pass default slot instead of raw children to components (#1915)
* Pass default slot instead of raw children to components This is essentially how the internal implementation of `<component>` works. This works even for element VNodes. * Update changelog
1 parent 0e147a0 commit 17de0a2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

packages/@headlessui-vue/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- Expose `close` function for `Menu` and `MenuItem` components ([#1897](https://github.com/tailwindlabs/headlessui/pull/1897))
1313
- Fix `useOutsideClick`, add improvements for ShadowDOM ([#1914](https://github.com/tailwindlabs/headlessui/pull/1914))
14+
- Prevent default slot warning when using a component for `as` prop ([#1915](https://github.com/tailwindlabs/headlessui/pull/1915))
1415

1516
## [1.7.3] - 2022-09-30
1617

packages/@headlessui-vue/src/utils/render.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ function _render({
147147
return children
148148
}
149149

150-
return h(as, Object.assign({}, incomingProps, dataAttributes), children)
150+
return h(as, Object.assign({}, incomingProps, dataAttributes), {
151+
default: () => children,
152+
})
151153
}
152154

153155
/**

0 commit comments

Comments
 (0)