Skip to content

changes to onSuccess callback #2964

@TkDodo

Description

@TkDodo

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions