Async routes #1468
Replies: 2 comments 2 replies
-
Take a look at createAsync - sounds like it may be what you're looking for? |
Beta Was this translation helpful? Give feedback.
-
If I'm understanding you correctly, you want to block the rendering of the component until the data has finished fetching, and only start rendering the component once it's finished loading? The second thing can be done by wrapping the JSX in a As for the first thing, it's generally not a good idea to block the rendering of a component at all. Solid can continue to render the component while the data is fetching, so that once the fetching is complete it has to do minimal work in updating the exact nodes that depend on the async data. |
Beta Was this translation helpful? Give feedback.
-
In SSR, it would appear to me that there is no easy way to asynchronously load data before rendering the component. Docs suggest using
"use server"
, but that's not what I want -- I do not want to generate an RPC route.createHandler
is async, so you could add data fetching there. But then you have to do your routing there, beforeApp
is rendered. And it's not easy to pass in your data toApp
either because of the implicit control flow fromStartServer
toApp
.Edit: I did try
createResource
. The server sends the fallback, it doesn't wait for the resource.Beta Was this translation helpful? Give feedback.
All reactions