How to make suspense work properly?
Hello guys, i have an next js app, and there is a catalog page, in ssr component i'm making fetch request for data and wraps this component in suspense with skeleton fallback, but on navigation it awaits request to be resolved and only then redirects me to the catalog page. What's the problem and how to redirect user immediately and show fallback while data is fetching?
here is an example https://stackblitz.com/edit/next-playground-oe67nrlp?file=app%2Fpage.tsx,app%2Fcatalog%2Fpage.tsx
5 Replies
Move data fetching to a
useEffect
hook in a client component to allow immediate rendering with a fallback while data loadsBut then where will be no seo for catalog, the primary page of the app
yes, it works the same way. I don't understand why suspense not showing fallback while fetching data, why it's waiting for resolving and only after that redirects me there?
Its weird, but i heard that if deactivate antivirus it will work, i tried it and it really works! so dumb
but it work only locally, on production it still not working:(
Wait for it to deploy I guess