Clemens
TTCTheo's Typesafe Cult
•Created by Clemens on 1/29/2024 in #questions
Setting queryHash with t3 useQuery good practice?
I'm just confused that it is so hard to just set an own query key
7 replies
TTCTheo's Typesafe Cult
•Created by Clemens on 1/29/2024 in #questions
Setting queryHash with t3 useQuery good practice?
It just feels wrong to directly set a queryHash. Maybe I could also write a custom queryHashFn 🤔
7 replies
TTCTheo's Typesafe Cult
•Created by Clemens on 1/29/2024 in #questions
Setting queryHash with t3 useQuery good practice?
Good question. I have multiple queries that only differ by
to
.
All in all, I think it makes most sense to simple set a custom query key for each query.
queryKey
is typed so that it only allows the predefined queryKey with the query parameters.
I think what I would prefer to do would be to be able to pass a custom queryKey instead of the predefined ["router.getTotalPosts", { from, to}]
] (changing the router.getTotalPosts
is not possible due to the typing7 replies