From 4f203aa94ed6f425bde55781104f3238a2b5f129 Mon Sep 17 00:00:00 2001 From: 0Jaemin0 Date: Mon, 18 May 2026 22:03:43 +0900 Subject: [PATCH 1/2] docs(reference): clarify query client query methods --- docs/reference/QueryClient.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/reference/QueryClient.md b/docs/reference/QueryClient.md index a4783788b4c..e0370634b0e 100644 --- a/docs/reference/QueryClient.md +++ b/docs/reference/QueryClient.md @@ -352,6 +352,11 @@ await queryClient.invalidateQueries( - Per default, a currently running request will be cancelled before a new request is made - When set to `false`, no refetch will be made if there is already a request running. +**Notes** + +- Unlike [`refetchQueries`](#queryclientrefetchqueries), `invalidateQueries` marks matching queries as invalid and then refetches them according to the `refetchType` option. +- Unlike [`removeQueries`](#queryclientremovequeries), `invalidateQueries` keeps matching queries in the cache. + ## `queryClient.refetchQueries` 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 - Queries that are "disabled" because they only have disabled Observers will never be refetched. - Queries that are "static" because they only have Observers with a Static StaleTime will never be refetched. +- Unlike [`invalidateQueries`](#queryclientinvalidatequeries), `refetchQueries` refetches matching queries without marking them as invalid first. ## `queryClient.cancelQueries` @@ -434,6 +440,10 @@ queryClient.removeQueries({ queryKey, exact: true }) This method does not return anything +**Notes** + +- Unlike [`invalidateQueries`](#queryclientinvalidatequeries) or [`refetchQueries`](#queryclientrefetchqueries), `removeQueries` removes matching queries from the cache instead of refetching them. + ## `queryClient.resetQueries` The `resetQueries` method can be used to reset queries in the cache to their From 0d43c1dd93d6641f7f3af6e70c4a4b02280b89a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Dorfmeister=20=F0=9F=94=AE?= Date: Fri, 22 May 2026 18:07:32 +0200 Subject: [PATCH 2/2] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Dominik Dorfmeister 🔮 --- docs/reference/QueryClient.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/QueryClient.md b/docs/reference/QueryClient.md index e0370634b0e..3c9e1b31c27 100644 --- a/docs/reference/QueryClient.md +++ b/docs/reference/QueryClient.md @@ -354,7 +354,7 @@ await queryClient.invalidateQueries( **Notes** -- Unlike [`refetchQueries`](#queryclientrefetchqueries), `invalidateQueries` marks matching queries as invalid and then refetches them according to the `refetchType` option. +- Unlike [`refetchQueries`](#queryclientrefetchqueries), `invalidateQueries` marks matching queries as invalidated and then refetches `active` queries (unless otherwise specified with the `refetchType` option). - Unlike [`removeQueries`](#queryclientremovequeries), `invalidateQueries` keeps matching queries in the cache. ## `queryClient.refetchQueries` @@ -400,7 +400,7 @@ This function returns a promise that will resolve when all of the queries are do - Queries that are "disabled" because they only have disabled Observers will never be refetched. - Queries that are "static" because they only have Observers with a Static StaleTime will never be refetched. -- Unlike [`invalidateQueries`](#queryclientinvalidatequeries), `refetchQueries` refetches matching queries without marking them as invalid first. +- Unlike [`invalidateQueries`](#queryclientinvalidatequeries), `refetchQueries` refetches all matching queries. ## `queryClient.cancelQueries`