createResource / Suspense blocks rendering
Im trying to understand how to handle async data fetching. Taking an example from the docs, with some modifications. This component seem to block rendering for 5 seconds, before displaying
Data fetched from API
, rather than showing the fallback in the Suspense element while the setTimeout is happening. I feel like im not understanding something here...
7 Replies
It should work Have a look here:
https://playground.solidjs.com/anonymous/b990a527-c631-4a60-a2f8-3792fbe13021
Maybe something else makes the component block
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
Hmm odd…
What could cause the entire component to block…?
something higher up probably. you could share the code and i can have a look if you want :)
Do you have SSR enabled? Loading a page via SSR will wait for resources to be resolved. CSR will trigger the Suspense instead as you would expect, i.e. navigating from another page.
The code is here. Im using the template from solid start
https://github.com/shawnyu5/FreshMeet/blob/feat/suspend/frontend/src/routes/meetup/test.tsx
uh how do I tell what i am using?
By default SSR is on in solid start. Try changing the vite config plugin line to this:
plugins: [solid({ ssr: false })]
ahh interesting... That did it
thanks!