Upgrading to Next 15, infinite refetching, no cache?
Hi, I'm trying to upgrade my t3 project that I started with next 14 a year ago, to Next 15...
I've used the codemod for it an Clerk to v6, but I'm getting a problem when I load a page, it queries again and again, infinitely, putting a huge load on my server.
I have my Query Client staleTime at 30 * 1000, but doesn't seem to be taking it into account.
If this helps, I'm fetching data in my TRPCContext to check session data.
Please help, let me know if I should send anything.
6 Replies
I have a project with T3 Next 15 working fine, and I tried copying everything that differs from my project... even then, my app continues with this weird behavior
App or pages router?
You able to share the project?
app router
I cant >.<
it seems I'm using a no longer supported approach or probably never was a good way to do it
it seems the pages that are having this behavior is when I'm fetching data using trpc on my server component to fetch data and then pass it as props to a client component
but im not sure yet if that's actually the problem
I'd read over https://trpc.io/docs/client/react/server-components
Set up with React Server Components | tRPC
This guide is an overview of how one may use tRPC with a React Server Components (RSC) framework such as Next.js App Router.
Advanced Server Rendering | TanStack Query React Docs
Welcome to the Advanced Server Rendering guide, where you will learn all about using React Query with streaming, Server Components and the Next.js app router. You might want to read the before this on...
Rsc and React Query/trpc require some extra steps to play nice
The fetching data in trpc context sounds wierd, do you mean in a middleware?
I strongly recommend you reproduce this in a Stackblitz if you can, it would help a tone