Skip to content

Commit 4f203aa

Browse files
committed
docs(reference): clarify query client query methods
1 parent 334161f commit 4f203aa

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 invalid and then refetches them according to 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 matching queries without marking them as invalid first.
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)