Composables
setQueryData()
You can set the query data manually by calling the setQueryData() function.
<script lang="ts" setup>
const trpc = useTRPC()
const { mutate: addToCart } = trpc.cart.addProduct.useMutation({
onSuccess: (newCart) => {
// this will update the `cart.get` query data
trpc.cart.get.setQueryData(newCart)
},
})
</script>