How to avoid triggering suspense fallback when using ssr prefetch+suspense after first render.
I have a component that uses useSuspenseQuery and the page uses prefetchQuery. The project is a next.js app router app. The client component has buttons that changes the params used in the query. Every change triggers the suspense fallback. Is there anyway to just render the suspense fallback for the initial render?
4 Replies
stormy-gold•10mo ago
I'd say you want this https://tanstack.com/query/latest/docs/framework/react/guides/placeholder-query-data#placeholder-data-as-a-function but useSuspenceQuery doesn't allow placeholderData
TanStack | High Quality Open-Source Software for Web Developers
Headless, type-safe, powerful utilities for complex workflows like Data Management, Data Visualization, Charts, Tables, and UI Components.

round-purpleOP•10mo ago
I found this article
round-purpleOP•10mo ago
Exploring using Suspense with React Query
Learn how I explored using Suspense with React Query and what issues I encountered and how I solved them.
round-purpleOP•10mo ago
useTransition solved the problem for me