Discussed in #2911
Originally posted by phatmann November 11, 2021
Calling QueryClient.setQueryData method triggers the onSuccess callback. For many users, including me, this is unexpected behavior, and can be the source of recursion issues, since the onSuccess handler might make calls to setQueryData.
I propose we create a new onDataChanged callback. This would be trigged when cache data is changed via setQueryData or via a fetch. The onSuccess callback would only be called after a successful fetch.
For completeness, the same onDataChanged callback would be added to QueryCache.
Discussed in #2911
Originally posted by phatmann November 11, 2021
Calling
QueryClient.setQueryDatamethod triggers theonSuccesscallback. For many users, including me, this is unexpected behavior, and can be the source of recursion issues, since theonSuccesshandler might make calls tosetQueryData.I propose we create a new
onDataChangedcallback. This would be trigged when cache data is changed viasetQueryDataor via a fetch. TheonSuccesscallback would only be called after a successful fetch.For completeness, the same
onDataChangedcallback would be added to QueryCache.