Radix Primitives is an open-source UI component library for building high-quality, accessible design systems and web apps. Maintained by @workos.
15.91k
stars
831
forks
source link
fix: do not pass ref into SlotClone component if children is a React.Fragment #3229
Open
terrymun opened 6 days ago
Description
This PR fixes the issue with consuming any Radix UI Primitive in React 19, which will throw the following error in the console (as reported in #3224):
The error seems to arise from not checking the type of the
children
prop, which could potentially be a React Fragment that does not acceptref
prop.Therefore, the
ref
prop is only conditionally added to the props of the<SlotClone>
element ifchildren
is not of typeReact.Fragment
.