setQuery triggers onSuccess #1411
-
Hi, first of all great work on React-query! I love it. We're doing an app where we need to update the local state based on websockets. To do that I use setQueryData which seems to be the correct solution. That works, but here's where I struggle: After getting data from the server, I need to open a socket connection for each item in the data. I do this on onSuccess. It feels to me that setQueryData should not fire the onSuccess. PS: where's the direct link to the v2 docs? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Hi 👋
I have tested this in both v3 and v2, and in both cases, So I guess it is intended, but I would've also thought otherwise 🤔
v2 docs now live under: https://react-query-v2.tanstack.com/ |
Beta Was this translation helpful? Give feedback.
Hi 👋
I have tested this in both v3 and v2, and in both cases,
onSuccess
seems to be called, have a look: https://codesandbox.io/s/musing-thompson-3h34eSo I guess it is intended, but I would've also thought otherwise 🤔
v2 docs now live under: https://react-query-v2.tanstack.com/