how to use createResource in Astro SSR

I’d like to use createResource in Astro. Right now I’m doing the data fetch in the Astro file and passing it to the Solid component as an attribute but it’s a 20kb response. I’d prefer if solid instead fetched the data and rendered the output with it and then only the final HTML was shipped down with the JavaScript to load the page. It would save a lot of time on download and parsing. How can I do this?
4 Replies
lxsmnsyc
lxsmnsyc2y ago
Astro doesn't do async SSR or streaming SSR so you can't use createResource in SSR
_calvinandhobbes
Well you can. You just need to pass initialData, and ssrLoadFrom = initial.
lxsmnsyc
lxsmnsyc2y ago
well that doesn't do data-fetching on the server but you're delegating it on another level (Astro), if that's part of your intent on top of that, the data is serialized twice: for Astro and for Solid
_calvinandhobbes
Ya I was curious if there’s a way to avoid the double serialization. Feels like there should be.
Want results from more Discord servers?
Add your server