TanStackT
TanStack3mo ago
4 replies
radical-lime

Loading state while loader data is loading

Hi TanStack Start people,

I have a simple file route that uses a server function to return some data from my database - what is the best way to show a loading state while the function is executing, similar to loading.tsx in Next.js?

I've tried defining a Route.pendingComponent but that doesn't seem to work - It just keeps the request loading for 2 seconds before returning the full value

Forgive me if the answer is clear, it's sometimes confusing for me whether I should be looking in the TanStack Start docs or the TanStack Router docs, both of which don't have very good searching

Here is my code with a Bun.sleep to simulate and see a good loading state:
3Gwu3qA.png
Was this page helpful?