tRPC, query invalidation is not working
This is the code I have inside the component
The mutation works fine but it doesn't invalidate the queries on success. I tried fetch(), refetch() and they don't work either. What am I missing?
Thanks!
const utils = trpc.useContext()
const students = trpc.student.getAll.useQuery()
const addStudentTRPC = trpc.student.add.useMutation({
onSuccess() {
utils.student.getAll.invalidate()
},
})The mutation works fine but it doesn't invalidate the queries on success. I tried fetch(), refetch() and they don't work either. What am I missing?
Thanks!
