radix-ui / primitives

Radix Primitives is an open-source UI component library for building high-quality, accessible design systems and web apps. Maintained by @workos.
https://radix-ui.com/primitives
MIT License
15.71k stars 812 forks source link

`asChild` doesn't work reliably with Server Components #3165

Open amannn opened 3 weeks ago

amannn commented 3 weeks ago

Bug report

Current Behavior

The asChild API doesn't work reliably with Server Components. It somehow works to some extent, but when children are declared with async or have a call to use(promise) internally, then the rendering fails.

Expected behavior

asChild should work reliably everywhere.

Reproducible example

Suggested solution

https://x.com/souporserious/status/1753859984344121754

Your environment

Please see the StackBlitz examples.

Software Name(s) Version
Radix Package(s) @radix-ui/react-dropdown-menu 2.1.1
React n/a 18.3.0
Browser Chrome Version 129.0.6668.60
Assistive tech - -
Node n/a 18.20.3
npm/yarn npm 10.2.3
Operating System macOS 14.6.1
yordis commented 2 weeks ago

@vladmoroz any updates over here? I just ran into the issue