pbesh
pbesh
TtRPC
Created by pbesh on 9/23/2022 in #❓-help
Modifying payload client-side before caching
I just ended up doing things like:
const client = trpc.useContext()
useQuery(['my-api-key', input], () => client.myApi.fetch(input).then(transform))
const client = trpc.useContext()
useQuery(['my-api-key', input], () => client.myApi.fetch(input).then(transform))
8 replies
TtRPC
Created by pbesh on 9/23/2022 in #❓-help
Modifying payload client-side before caching
I think I'll give it a shot, thanks for your help!
8 replies
TtRPC
Created by pbesh on 9/23/2022 in #❓-help
Modifying payload client-side before caching
Like setting the cached query data manually via the query client? Hmm maybe, sounds a bit tricky or error prone though. Maybe an alternative would be not to use trpc's generated useQuery and instead use useQuery directly calling trpc's generated query function for the data myself
8 replies
TtRPC
Created by pbesh on 9/23/2022 in #❓-help
Recommended way to prefetch client-side
ahhhhh gotcha! I did see useContext kinda worked but couldn't find docs on it. thank you!
4 replies