Skip to content

Invalidating Queries on all query keys in group #1736

Answered by Redmega
Morzaram asked this question in Q&A
Discussion options

You must be logged in to vote

Double check your usage of getConversationQueryKey, I believe that should be a function which returns an array, and not an object with a .name property as you've shown in your example. I don't think it has name at all actually (Unless maybe name comes from the openapi spec and I just don't have them set in my yml).

_id should be consistent between your different getConversationOptions calls, so you can use predicate to invalidate them:

queryClient.invalidateQueries({
  predicate: (query) =>
    query.queryKey[0]._id === getConversationQueryKey()[0]._id // or use the operation id "getConversation" or whatever it happens to be 
})

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Morzaram
Comment options

@mrlubos
Comment options

Answer selected by Morzaram
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants