schlabach
schlabach
TtRPC
Created by patrick on 10/27/2023 in #❓-help
cache craziness?
also not sure why but removing the QueryClientProvider seems to fix it...
6 replies
TtRPC
Created by patrick on 10/27/2023 in #❓-help
cache craziness?
yep... @p.j.n. lmk if you ever figured it out. I am calling setData(...optimisticData) to try and update the cache. When I call getData then it returns the optimistic data. But in the body of my component, trpc is still returning stale data from the server?? Are you using Next? it seems like there might be a bug with the nextjs integration (https://github.com/trpc/trpc/issues/3706)
6 replies
TtRPC
Created by schlabach on 6/23/2023 in #❓-help
Prefetch on useContext() is not being picked up by react-query.
Trpc’s docs do talk a lot about prefetching in getServerSideProps. But Tanstack Query supports prefetching and caching data on the client as well, which is what I need to do https://tanstack.com/query/v4/docs/react/guides/prefetching https://trpc.io/docs/client/react/useContext
6 replies
TtRPC
Created by Tom on 6/26/2023 in #❓-help
How to prefetch data on the client into the cache?
Lmk if you have any success with this.
18 replies
TtRPC
Created by Tom on 6/26/2023 in #❓-help
How to prefetch data on the client into the cache?
I'm dealing with the same issue (https://discord.com/channels/867764511159091230/1121910827335831674). According to the docs, you should be able to use trpc.useContext() for this:
const utils = trpc.useContext()

utils.subRoute.prefetch({...inputs})
const utils = trpc.useContext()

utils.subRoute.prefetch({...inputs})
However, this prefetch() isn't being picked up by React Query and the data isn't being cached. Inspecting Chrome's devtools reveals that the fetch is being made, but it doesn't seem like React Query is picking up on that. https://trpc.io/docs/client/react/useContext
18 replies
TtRPC
Created by schlabach on 6/23/2023 in #❓-help
Prefetch on useContext() is not being picked up by react-query.
Has anyone been able to figure this out?
6 replies