File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
1212- Call ` displayValue ` with a v-model of ` ref(undefined) ` on ` ComboboxInput ` ([ #1865 ] ( https://github.com/tailwindlabs/headlessui/pull/1865 ) )
1313- Improve ` Portal ` detection for ` Popover ` components ([ #1842 ] ( https://github.com/tailwindlabs/headlessui/pull/1842 ) )
14+ - Fix crash when ` children ` are ` undefined ` ([ #1885 ] ( https://github.com/tailwindlabs/headlessui/pull/1885 ) )
1415
1516## [ 1.7.2] - 2022-09-15
1617
Original file line number Diff line number Diff line change @@ -91,6 +91,12 @@ describe('Safe guards', () => {
9191
9292describe ( 'Rendering' , ( ) => {
9393 describe ( 'Menu' , ( ) => {
94+ it ( 'should not crash when rendering no children at all' , ( ) => {
95+ renderTemplate ( jsx `
96+ <Menu></Menu>
97+ ` )
98+ } )
99+
94100 it ( 'should be possible to render a Menu using a default render prop' , async ( ) => {
95101 renderTemplate ( jsx `
96102 <Menu v-slot="{ open }">
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ function _render({
108108 }
109109
110110 if ( as === 'template' ) {
111- children = flattenFragments ( children as VNode [ ] )
111+ children = flattenFragments ( children ?? [ ] )
112112
113113 if ( Object . keys ( incomingProps ) . length > 0 || Object . keys ( attrs ) . length > 0 ) {
114114 let [ firstChild , ...other ] = children ?? [ ]
You can’t perform that action at this time.
0 commit comments