T
tRPC

How to refetch based on different event

How to refetch based on different event

YYusuf8/8/2023
I have a procedure that fetches all products, I have another one that deletes a project given it's ID, these two are used on the same page, how can tell tRPC to rerun the allProducts request when a delete happens. currently I need to refresh to see the product get deleted, in case that's not what's supposed to happen please tell me. I am using the pages router and tRPC v10
AAleed.dev8/14/2023
i know of two ways . first is to invalidate the cahce result . second react query provide a refetch function that you can call when ever their is a mutation https://tanstack.com/query/v4/docs/react/guides/query-invalidation here is the doc explaining how to do it

Looking for more? Join the community!

T
tRPC

How to refetch based on different event

Join Server