Cylonik (Tom)C
tRPC2y ago
1 reply
Cylonik (Tom)

Adding trpc.useQuery hook to Next.js page with react-hook-form prevents stateful refresh.

Hi, I'm new to tRPC so apologies if I've worded this poorly. I've got a page with a form managed by react-hook-query and Yup and SWR. I'm trying to migrate over to tRPC and Zod so I've been following the examples. I noticed that stateful refresh was no longer working once I'd added tRPC to the page - form details are no longer retained when making code changes. I found that by removing the following line it started working again.

const hello = trpc.hello.useQuery({text: 'client'});

Why would this be happening and is there a workaround?

I'm using Next 13.5 with Pages and tRPC 11-next-beta.300.

Many thanks, Tom
Was this page helpful?