How do you stop this behavior?
I have a mutation that looks like this.
Problem is, when I quickly click on the different answers(see gif), it does the laggy thing where the old onSettled catches up.
I thought cancelling of the queries via
await queryClient.cancelQueries(qf); would've stopped the previous invalidations.
3 Replies
eastern-cyan•7mo ago
wise-whiteOP•7mo ago
thanks, a lot. that's exactly what I was looking for
foreign-sapphire•7mo ago
I wrote about this this week: https://tkdodo.eu/blog/concurrent-optimistic-updates-in-react-query
Concurrent Optimistic Updates in React Query
How to build optimistic UI that is resilient to race conditions, even when multiple mutations update the same entity concurrently.