Replies: 1 comment 1 reply
-
the issue you are linking was about
you also have the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This request is similar to #268, except that I'm talking about
useQuery
, notuseMutation
.In general, it'd be nice to know http request parameters in
onSuccess
handler ofuseQuery
. According to the docs it's good pattern to put http parameters inqueryKey
, to naturally create different keys for different http requests.Why do we need to know request parameters in
onSuccess
?I think that scenario could be similar to the one described in #268. If two queries logically share some data, it makes sense to update cached values of one of them when another is received.
Here's a 'real' example:
We have a master/detail page with a list of users with their names (on Master), and details of a single user (on Details).
Master and Details are shown within one screen.
When we request Details for the User there could be that the Name of the User is different from the one displayed in the List (because it was just changed by someone else).
We'd like to update the cache of the List query, if we received a different Name in Details query.
If we say that List results look like this:
/users: [{id: 1, Name: 'John'}, {id: 2, Name: 'Helen} ]
and Details results look like this:
/user/1 {Name: 'John', LastName: 'Doe', ... }
If there's no
id
field in details result, it becomes impossible to update the cache of the List inonSuccess
handler of Details query.Beta Was this translation helpful? Give feedback.
All reactions