Feature Request: Expose queryKey and ability to manage setQueryData from UseQueryResult and UseInfiniteQueryResult #5292
Replies: 1 comment 3 replies
-
This has been asked a lot before, but I'm still hesitant because while a typed The only place where it makes sense to call
Even if the mutation lives in the same component as the query, which it often will not, you will have to pass |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Currently the only way to update the query cache is through
queryClient
but it is often inconvenient to reconstruct queryKey from the place where we want to update the cache.
A contrived example can be as following
Proposal
It would be great if
UseQueryResult
andUseInfiniteQueryResult
can expose thequeryKey
andsetQueryData
method. so that instead of above, I can directly doLet me know if it makes sense, thx!
Beta Was this translation helpful? Give feedback.
All reactions