Next.js Discord

Discord Forum

Shadcn Sheet Hydration error?

Unanswered
Headless posted this in #help-forum
Open in Discord
anyone know why i would be getting Shadcn UI hydration errors
whenever I try to set the open state by default to true when the page first loads

6 Replies

i just solved this with dynamic imports but
is there a better solution?
@Headless anyone know why i would be getting Shadcn UI hydration errors whenever I try to set the open state by default to true when the page first loads
Shadcn is based on radix portal which has a bug where it cannot be open during prerendering
So the recommended solution is to initialise it to not open, then open it in a useEffect
@Headless i just solved this with dynamic imports but
Or skip prerendering for it which is what you did here