Skip to content

Commit 98fd431

Browse files
0Jaemin0TkDodo
andauthored
docs(reference/QueryClient): clarify query client query methods (#10725)
* docs(reference): clarify query client query methods * Apply suggestions from code review Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc> --------- Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
1 parent d9b2ca7 commit 98fd431

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

docs/reference/QueryClient.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,11 @@ await queryClient.invalidateQueries(
352352
- Per default, a currently running request will be cancelled before a new request is made
353353
- When set to `false`, no refetch will be made if there is already a request running.
354354

355+
**Notes**
356+
357+
- Unlike [`refetchQueries`](#queryclientrefetchqueries), `invalidateQueries` marks matching queries as invalidated and then refetches `active` queries (unless otherwise specified with the `refetchType` option).
358+
- Unlike [`removeQueries`](#queryclientremovequeries), `invalidateQueries` keeps matching queries in the cache.
359+
355360
## `queryClient.refetchQueries`
356361

357362
The `refetchQueries` method can be used to refetch queries based on certain conditions.
@@ -395,6 +400,7 @@ This function returns a promise that will resolve when all of the queries are do
395400

396401
- Queries that are "disabled" because they only have disabled Observers will never be refetched.
397402
- Queries that are "static" because they only have Observers with a Static StaleTime will never be refetched.
403+
- Unlike [`invalidateQueries`](#queryclientinvalidatequeries), `refetchQueries` refetches all matching queries.
398404

399405
## `queryClient.cancelQueries`
400406

@@ -434,6 +440,10 @@ queryClient.removeQueries({ queryKey, exact: true })
434440

435441
This method does not return anything
436442

443+
**Notes**
444+
445+
- Unlike [`invalidateQueries`](#queryclientinvalidatequeries) or [`refetchQueries`](#queryclientrefetchqueries), `removeQueries` removes matching queries from the cache instead of refetching them.
446+
437447
## `queryClient.resetQueries`
438448

439449
The `resetQueries` method can be used to reset queries in the cache to their

0 commit comments

Comments
 (0)