T
tRPC

❓-help

v10, passing useQuery options, queryKey mandatory?

SSimon1/16/2024
I have a simple query like this
const me = api.user.me.useQuery(undefined, {
enabled: true,
})
const me = api.user.me.useQuery(undefined, {
enabled: true,
})
which results in an error Property 'queryKey' is missing in type .... So I have to pass the queryKey eventho it should be automatically generated?
Solution:
hm, anyways it seems to work now, maybe a restart of VS code. I will close as solved
Jump to solution
SSebasPtsch1/16/2024
if you've installed react query v5 with trpc v10 this error will ocur. Make sure that you have v4 of tanstack query installed
SSimon1/16/2024
Oups, my mistake, I meant v11
"@trpc/client": "11.0.0-next-beta.193",
"@trpc/next": "11.0.0-next-beta.193",
"@trpc/react-query": "11.0.0-next-beta.193",
"@trpc/server": "11.0.0-next-beta.193",
"@trpc/client": "11.0.0-next-beta.193",
"@trpc/next": "11.0.0-next-beta.193",
"@trpc/react-query": "11.0.0-next-beta.193",
"@trpc/server": "11.0.0-next-beta.193",
Solution
SSimon1/16/2024
hm, anyways it seems to work now, maybe a restart of VS code. I will close as solved

Looking for more? Join the community!