ui
ui copied to clipboard
Error when Clicking Radio Buttons in Shadcn UI in Next.js 13
I am encountering an issue in my Next.js 13 project when using the Shadcn UI library's Radio Group component. When I try to click to switch the radio buttons, I receive the following error:
TypeError: Object is not a constructor (evaluating 'new Event('click', { bubbles: bubbles })')
I suspect this error may be related to the use of the click event in the Radix UI library, which is used by Shadcn. Since Next.js server-side rendering (SSR) may not have access to the window or document objects, it could be causing this issue.
I have already attempted to import the RadioGroup and RadioGroupItem dynamically to handle this issue, but the error persists.
Can you please confirm if this issue is related to the Radix UI library's use of the click event and the lack of window or document in the server environment? Additionally, any guidance or suggestions on how to resolve this issue would be greatly appreciated.