Following docs for "persistent layouts with SSR" doesnt work
laneme opened this issue · 3 comments
Quick look at this issue seem to be related to the onLayout
callback.
onLayout
apparently fires before the defaultSize
is set, resetting the document.cookie value. So the flickerring persist.
To reproduce, visit https://ui.shadcn.com/examples/mail, see the cookie is reset after page refresh. The reset doesnt happen if you remove the onLayout
.
You can view the code from here. apps/www/app/(app)/examples/mail/components/mail.tsx
This issue hasn't impacted me or any of my projects using the library. If you'd like to submit a proposed fix, I'll review it.
My bad. My assumptions were wrong about the onLayout
behavior.
The reason this happened (on my version) was because I only set defaultValue
for the first panel, out of two panels. Which felt intuitive for me.
And the issue on shadcn's version is probably different, even though that looked identical to mine.
I pushed a pr to update the docs with a note at the bottom.
Thanks for the PR and for the follow up. Glad you go this sorted out.