Closed alrightsure closed 1 month ago
hey there, after reading this issue i decided to create a new utility function, can you please upgrade to the latest api and try this new function?
https://mediakit-taupe.vercel.app/prpc/useutils
const utils = testQuery2.useUtils()
const helloRes1 = testQuery2(() => ({
hello: 'jdev',
}))
const helloRes2 = testQuery2(() => ({
hello: 'jdev22',
}))
const helloMutation = testMutation(() => ({
async onSuccess() {
console.log('invalidate all testQuery2')
await utils.invalidate()
// invalidate only jdev
await utils.invalidate({ hello: 'jdev' })
// invalidate only jdev22
await utils.invalidate({ hello: 'jdev22' })
},
}))
just lmk if it works for you as expected
Awesome!
It looks like the revalidation still seems iffy like the refetch, where it will work after the first mutation but then not after the next. I'll see if I can make a minimal reproduction tonight and get back to you.
Awesome!
It looks like the revalidation still seems iffy like the refetch, where it will work after the first mutation but then not after the next. I'll see if I can make a minimal reproduction tonight and get back to you.
Alright. If you can't do a repro, could you just send me the part where you calls the mutation & revalidate
Please reopen with more info
Hello All,
I love the ease of use of PRPC, but am still confused as to how to use it properly. If I have a query and a mutation on the same page, how would I invalidate/refetch the query after the mutation fires? I have tried calling [query].reftch() in the onSuccess of the mutation, but that doesn't always seem to work, and the revalidate function from the solid router also doesn't seem to do the trick.