Composables
invalidate()
You can invalidate a query by calling the invalidate() function.
<script lang="ts" setup>
const trpc = useTRPC()
const { mutate: addToCart } = trpc.cart.addProduct.useMutation({
onSuccess: () => {
// this will invalidate and refetch the `cart.get` query
trpc.cart.get.invalidate()
},
})
</script>