
Some methods within Svelte Query accept a QueryFilters object. A query filter is an object with certain conditions to match a query with:
// Cancel all queriesawait queryClient.cancelQueries()// Remove all inactive queriesqueryClient.removeQueries('posts', { inactive: true })// Refetch all active queriesawait queryClient.refetchQueries({ active: true })// Refetch all active queries that begin with `post` in the keyawait queryClient.refetchQueries('posts', { active: true })
A query filter object supports the following properties:
exact?: booleanexact: true option to return only the query with the exact query key you have passed.active?: booleantrue it will match active queries.false it will match inactive queries.inactive?: booleantrue it will match inactive queries.false it will match active queries.stale?: booleantrue it will match stale queries.false it will match fresh queries.fetching?: booleantrue it will match queries that are currently fetching.false it will match queries that are not fetching.predicate?: (query: Query) => booleanfound.queryKey?: QueryKeyThe latest TanStack news, articles, and resources, sent to your inbox.