Skip to content

Commit 6d6d9d0

Browse files
villesauTkDodo
andauthored
docs(setQueriesData): Make setQueriesData more searchable (#3244)
* docs(setQueriesData): Make setQueriesData more searchable - Makes setQueriesData more searchable - Change mention of fuzzily matching to partial matching since fuzzy matching is more arbitrary algorithm - Mention setQueriesData in setQueryData to avoid confusion of behaviours The purpose of this change is to make setQueriesData a bit more searchable from the docs to avoid confusion like this: #3239 * Apply suggestions from code review Co-authored-by: Ville Saukkonen <[email protected]> Co-authored-by: Dominik Dorfmeister <[email protected]>
1 parent b38eed6 commit 6d6d9d0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/src/pages/reference/QueryClient.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ This distinction is more a "convenience" for ts devs that know which structure w
203203

204204
## `queryClient.setQueryData`
205205

206-
`setQueryData` is a synchronous function that can be used to immediately update a query's cached data. If the query does not exist, it will be created. **If the query is not utilized by a query hook in the default `cacheTime` of 5 minutes, the query will be garbage collected**.
206+
`setQueryData` is a synchronous function that can be used to immediately update a query's cached data. If the query does not exist, it will be created. **If the query is not utilized by a query hook in the default `cacheTime` of 5 minutes, the query will be garbage collected**. To update multiple queries at once and match query keys partially, you need to use [`queryClient.setQueriesData`](#queryclientsetqueriesdata) instead.
207207

208208
After successful changing query's cached data via `setQueryData`, it will also trigger `onSuccess` callback from that query.
209209

@@ -250,7 +250,7 @@ console.log(state.dataUpdatedAt)
250250

251251
## `queryClient.setQueriesData`
252252

253-
`setQueriesData` is a synchronous function that can be used to immediately update cached data of multiple queries. Only queries that match the passed queryKey or queryFilter will be updated - no new cache entries will be created. Under the hood, [`setQueryData`](#queryclientsetquerydata) is called for each query.
253+
`setQueriesData` is a synchronous function that can be used to immediately update cached data of multiple queries by using filter function or partially matching the query key. Only queries that match the passed queryKey or queryFilter will be updated - no new cache entries will be created. Under the hood, [`setQueryData`](#queryclientsetquerydata) is called for each query.
254254

255255
```js
256256
queryClient.setQueriesData(queryKey | filters, updater)
@@ -259,7 +259,7 @@ queryClient.setQueriesData(queryKey | filters, updater)
259259
**Options**
260260

261261
- `queryKey: QueryKey`: [Query Keys](../guides/query-keys) | `filters: QueryFilters`: [Query Filters](../guides/filters#query-filters)
262-
- if a queryKey is passed as first argument, queryKeys fuzzily matching this param will be updated
262+
- if a queryKey is passed as first argument, queryKeys partially matching this param will be updated
263263
- if a filter is passed, queryKeys matching the filter will be updated
264264
- `updater: TData | (oldData: TData | undefined) => TData`
265265
- the [setQueryData](#queryclientsetquerydata) updater function or new data, will be called for each matching queryKey

0 commit comments

Comments
 (0)