Unexpected behaviour on a shuffled hardcoded list with Solid Start
I'm currently experiencing a fascinating issue. Given the code:
When SSR is rendering the place.image + the place.name match. But when hydration on the client happens then the image and the name does not render correctly, seems like is updating the image but not the name, and I can't figure out why this is happening.
7 Replies
I also tried to add the shuffle inside a createEffect and update places with a setPlaces Setter. But not success.
You can see the image missmatch happening on https://viatsy.com/ (site under construction)
Viatsy - Travel made easy
All you business needs in one app
I guess the ssr'd output and the client's output will be different with your current implementation, causing hydration issues.
maybe try
createResource
instead. I think with createResource the output/promises are serialized.
You can see the image missmatch happening on https://viatsy.com/ (site under construction)i looked at the site but couldn't notice anything peculiar as i don't know how the images are supposed to look like.
Ey @bigmistqke , thanks for your reply.
In regards of the page, you can inspect the html, the images are named as the placeholder 🙂
Let me try createResource.
I can confirm that createResource does the job
Why does it work, though?
So it generates the resource on the server and does not regenerate in client as it gets serialised from server?
So it generates the resource on the server and does not regenerate in client as it gets serialised from server?exactly before you were creating two different states, because it's randomised, causing hydration mismatches. kind of surprising it didn't error too.
https://www.youtube.com/watch?v=oQ1zn7cdtyU is a nice presentation on suspense/resource if u wanna know mor
Future Frontend
YouTube
Ryan Carniato - SolidJS: Why all the Suspense?
In this talk Ryan discusses SolidJS and its relationship with React's Suspense.
Slides: https://docs.google.com/presentation/d/1NoJtBdpf13noV-4MebYMZkhJhWn4Y79-7f00SlSCAmc
Roger that! Thank you so much
I'll watch the presentation tonight! 💪 Thanks 🙂
ur welcome!