Suspense confusion
Given the following:
I expected to initially see
Header
and Footer
and Loading...
and then after 5 seconds see the random number, but instead I get a blank screen for 5 seconds and then see everything.
I have a reproduction here:
https://stackblitz.com/edit/vitejs-vite-sryzjy?file=src%2FApp.tsx
Am I fundamentally misunderstanding how useSuspenseQuery
works?Michael Wolfenden
StackBlitz
Vitejs - Vite (forked) - StackBlitz
Next generation frontend tooling. It's fast!
2 Replies
genetic-orange•10mo ago
more like how suspense works. Suspense must be around the component that suspends. The suspending part is
useQuery
, so you need:
The component istself is then de-coupled from loading states and reads just:
skilled-limeOP•10mo ago
Ahhhhhh, cheers for the speedy reply @TkDodo 🔮