Skip to content
Discussion options

You must be logged in to vote

#1725 only wanted exact as true for getQueryData, which makes total sense. Otherwise, you might get a random entry (the first one that matches), which is not what is wanted.

For invalidation, I think it all boils down to how you structure your query keys: https://tkdodo.eu/blog/effective-react-query-keys

if you have:

["todos"]
["todos", "1"]
["todos", "2"]

and you only want todos, you need to specify exact. Which is why I prefer:

["todos", { type: list }]
["todos", { type: 'detail', id: 1 }]
["todos", { type: 'detail', id: 2 }]

because that very explicitly allows me to either target everything todo related, or only the list (or lists, if I have multiple with filters), or a specific deta…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@chrisurlaub
Comment options

Answer selected by chrisurlaub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants