As you can see if we get a null as a result for group in line 399, we will take the second branch in line 404.
As you know if item.closest(GROUP_ITEMS_SELECTOR) is null, then item.closest(``${GROUP_ITEMS_SELECTOR} > *``) will definitely be null as well.
So in line 405 you will try to feed null as the parameter, which will result in an error:
Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
Edit:
It seems, this happens, when there is no group In the list, and it is "portalled" to the body.
Im not entirely sure how we run into this issue, but I know there is an issue with this code: https://github.com/pacocoursey/cmdk/blob/541fad217d1695c2190afdcc2c42c23d5ad70605/cmdk/src/index.tsx#L399-L407
As you can see if we get a
null
as a result for group in line 399, we will take the second branch in line 404. As you know ifitem.closest(GROUP_ITEMS_SELECTOR)
isnull
, thenitem.closest(``${GROUP_ITEMS_SELECTOR} > *``)
will definitely benull
as well.So in line 405 you will try to feed
null
as the parameter, which will result in an error:Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
Edit: It seems, this happens, when there is no group In the list, and it is "portalled" to the body.