schlabach
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
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
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:
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