Does partial matching apply to query keys?
For invalidateQueries, do query keys just need to meet the subset of query keys or must it be exact.
For example, if i have two queries that have the following queryKeys: ['hello'] and ['hello', 'world'] would invalidating ['hello'] invalidate both of the queries? I assume not since queryKeys are hashed at some point?
4 Replies
itchy-amethyst•14mo ago
Filters | TanStack Query React Docs
Some methods within TanStack Query accept a QueryFilters or MutationFilters object.
Query Filters
itchy-amethyst•14mo ago
queryKey
s are hierarchal, so yes invalidating ['hello']
also invalidates ['hello', 'world']
broad-brownOP•14mo ago
Tysm!
itchy-amethyst•14mo ago
To be clear, unless you use
exact: true
then yes they both invalidate