TanStackT
TanStack4mo ago
2 replies
dead-brown

Fallback component and ssr: "data-only"

Is there a way to show the fallback component of a route while the route's loader/beforeLoad is loading the data?

This is what I want to achieve:
- Let's say I have a /books route and in this router's loader function I'm doing a fetch call to get some books which takes 5 seconds.
- While the data is being loaded, I want to show a spinner without waiting for the data to be available.
- Once the data loads, we show the route's component.

The current behavior:
- The loader takes 5 seconds to resolve.
- Then, the spinner is displayed for the
minPendingMs
.
- Then, we show the route's component.
Was this page helpful?