From 8fd95c1f9a11627424dfdbedf1b8468a770bc8aa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Jun 2026 10:47:09 +0000 Subject: [PATCH 1/8] Initial plan From a31c5b38b802061cb6f0ca5f57dc43f03dbaced4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Jun 2026 10:51:41 +0000 Subject: [PATCH 2/8] Add skipToken refetch caveat to migration guide Co-authored-by: phryneas <4282439+phryneas@users.noreply.github.com> --- docs/source/migrating/apollo-client-4-migration.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/source/migrating/apollo-client-4-migration.mdx b/docs/source/migrating/apollo-client-4-migration.mdx index c30e711a4af..1c7b4592847 100644 --- a/docs/source/migrating/apollo-client-4-migration.mdx +++ b/docs/source/migrating/apollo-client-4-migration.mdx @@ -997,6 +997,8 @@ As a result of this change, the definitions for _active_ and _inactive_ queries A query is in standby if it is skipped with the `skip` option or `skipToken` in a React hook, or if the `fetchPolicy` is set to `standby`. +Although both `skip` and `skipToken` put a query in standby, `client.refetchQueries({ include: [QUERY] })` handles them differently before the first execution. Queries created with `skip: true` can still be refetched because Apollo Client already has their options, including any variables. Queries created with `skipToken` are excluded until after their first execution because Apollo Client doesn't know which variables to use yet. This behavior was introduced in v4.0.11. + This change affects the queries returned by `client.getObservableQueries` or the queries fetched by `refetchQueries` when using the `"active"` or `"all"` keywords, as these no longer include `ObservableQuery` instances without subscribers. From 7dfa2a2460045ea58745ab4c13b61267d6d9e79c Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Thu, 25 Jun 2026 13:11:49 +0200 Subject: [PATCH 3/8] Apply suggestion from @phryneas --- docs/source/migrating/apollo-client-4-migration.mdx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/source/migrating/apollo-client-4-migration.mdx b/docs/source/migrating/apollo-client-4-migration.mdx index 1c7b4592847..0b27eb91054 100644 --- a/docs/source/migrating/apollo-client-4-migration.mdx +++ b/docs/source/migrating/apollo-client-4-migration.mdx @@ -997,7 +997,8 @@ As a result of this change, the definitions for _active_ and _inactive_ queries A query is in standby if it is skipped with the `skip` option or `skipToken` in a React hook, or if the `fetchPolicy` is set to `standby`. -Although both `skip` and `skipToken` put a query in standby, `client.refetchQueries({ include: [QUERY] })` handles them differently before the first execution. Queries created with `skip: true` can still be refetched because Apollo Client already has their options, including any variables. Queries created with `skipToken` are excluded until after their first execution because Apollo Client doesn't know which variables to use yet. This behavior was introduced in v4.0.11. +Although both `skip` and `skipToken` put a query in standby, `client.refetchQueries({ include: [QUERY] })` handles them differently before the first execution. Queries you create with `skip: true` can still be refetched because Apollo Client already has their options, including any variables that might be needed for refetching. +Queries you create with `skipToken` are excluded until after their first execution because Apollo Client doesn't know which variables to use yet. This behavior was introduced in Apollo Client v4.0.11. From 1936b2cfc5c50bf7725fb54fd7f6bb4df5085abd Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Thu, 25 Jun 2026 13:35:15 +0200 Subject: [PATCH 4/8] bump From 41b994f7ac754afbaa4957b0229f9c2527a92f19 Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Thu, 25 Jun 2026 13:59:26 +0200 Subject: [PATCH 5/8] bump From 2d070c2c991b314e1c8acf24eafac08a7f0843d7 Mon Sep 17 00:00:00 2001 From: phryneas <4282439+phryneas@users.noreply.github.com> Date: Thu, 25 Jun 2026 12:03:54 +0000 Subject: [PATCH 6/8] Clean up Prettier, Size-limit, and Api-Extractor --- .size-limits.json | 8 ++++---- docs/source/migrating/apollo-client-4-migration.mdx | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.size-limits.json b/.size-limits.json index d842cc08273..201d3dec8a5 100644 --- a/.size-limits.json +++ b/.size-limits.json @@ -1,6 +1,6 @@ { - "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (CJS)": 47873, - "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production) (CJS)": 42183, - "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\"": 35925, - "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production)": 29449 + "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (CJS)": 47960, + "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production) (CJS)": 42273, + "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\"": 35984, + "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production)": 29491 } diff --git a/docs/source/migrating/apollo-client-4-migration.mdx b/docs/source/migrating/apollo-client-4-migration.mdx index 0b27eb91054..1f9bb212452 100644 --- a/docs/source/migrating/apollo-client-4-migration.mdx +++ b/docs/source/migrating/apollo-client-4-migration.mdx @@ -997,7 +997,7 @@ As a result of this change, the definitions for _active_ and _inactive_ queries A query is in standby if it is skipped with the `skip` option or `skipToken` in a React hook, or if the `fetchPolicy` is set to `standby`. -Although both `skip` and `skipToken` put a query in standby, `client.refetchQueries({ include: [QUERY] })` handles them differently before the first execution. Queries you create with `skip: true` can still be refetched because Apollo Client already has their options, including any variables that might be needed for refetching. +Although both `skip` and `skipToken` put a query in standby, `client.refetchQueries({ include: [QUERY] })` handles them differently before the first execution. Queries you create with `skip: true` can still be refetched because Apollo Client already has their options, including any variables that might be needed for refetching. Queries you create with `skipToken` are excluded until after their first execution because Apollo Client doesn't know which variables to use yet. This behavior was introduced in Apollo Client v4.0.11. From 0afee479779b5a74bd5524689314f810618ddfeb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 30 Jun 2026 15:44:03 +0000 Subject: [PATCH 7/8] Document standby refetch v3 workaround Co-authored-by: jerelmiller <565661+jerelmiller@users.noreply.github.com> --- .../migrating/apollo-client-4-migration.mdx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/source/migrating/apollo-client-4-migration.mdx b/docs/source/migrating/apollo-client-4-migration.mdx index 1f9bb212452..0c72aad1f3c 100644 --- a/docs/source/migrating/apollo-client-4-migration.mdx +++ b/docs/source/migrating/apollo-client-4-migration.mdx @@ -1002,6 +1002,21 @@ Queries you create with `skipToken` are excluded until after their first executi + + +To keep Apollo Client 3 behavior when you call +`client.refetchQueries({ include: ["queryName"] })`, use `onQueryUpdated` +to skip queries in standby: + +```ts +client.refetchQueries({ + include: ["queryName"], + onQueryUpdated: (observable) => observable.options.fetchPolicy !== "standby", +}); +``` + + + This change affects the queries returned by `client.getObservableQueries` or the queries fetched by `refetchQueries` when using the `"active"` or `"all"` keywords, as these no longer include `ObservableQuery` instances without subscribers. ### Removal of the `canonizeResults` option From 35ee66a193d8115c9ae62b5de6fca8c7a37aa774 Mon Sep 17 00:00:00 2001 From: Jerel Miller Date: Tue, 30 Jun 2026 10:31:01 -0600 Subject: [PATCH 8/8] Rework section --- .../migrating/apollo-client-4-migration.mdx | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/docs/source/migrating/apollo-client-4-migration.mdx b/docs/source/migrating/apollo-client-4-migration.mdx index 0c72aad1f3c..503aa0502d1 100644 --- a/docs/source/migrating/apollo-client-4-migration.mdx +++ b/docs/source/migrating/apollo-client-4-migration.mdx @@ -995,29 +995,35 @@ As a result of this change, the definitions for _active_ and _inactive_ queries -A query is in standby if it is skipped with the `skip` option or `skipToken` in a React hook, or if the `fetchPolicy` is set to `standby`. - -Although both `skip` and `skipToken` put a query in standby, `client.refetchQueries({ include: [QUERY] })` handles them differently before the first execution. Queries you create with `skip: true` can still be refetched because Apollo Client already has their options, including any variables that might be needed for refetching. -Queries you create with `skipToken` are excluded until after their first execution because Apollo Client doesn't know which variables to use yet. This behavior was introduced in Apollo Client v4.0.11. +A query is in standby if it is skipped with the `skip` option or `skipToken` in a React hook, or if the `fetchPolicy` is set to `standby`.

- +This change affects the queries returned by `client.getObservableQueries` or the queries fetched by `refetchQueries` when using the `"active"` or `"all"` keywords, as these no longer include `ObservableQuery` instances without subscribers. -To keep Apollo Client 3 behavior when you call -`client.refetchQueries({ include: ["queryName"] })`, use `onQueryUpdated` -to skip queries in standby: +#### Named queries in standby are refetched + +Named queries in standby provided to `client.refetchQueries({ include: ["queryName"] })` or `client.refetchQueries({ include: [QUERY] })` were skipped in Apollo Client 3 and a warning was logged. + +Apollo Client 4 now refetches named queries in standby. If you want to keep the Apollo Client 3 behavior, use the `onQueryUpdated` option to skip queries in standby: ```ts client.refetchQueries({ include: ["queryName"], - onQueryUpdated: (observable) => observable.options.fetchPolicy !== "standby", + onQueryUpdated: (observableQuery) => + observableQuery.options.fetchPolicy !== "standby", }); ``` - + -This change affects the queries returned by `client.getObservableQueries` or the queries fetched by `refetchQueries` when using the `"active"` or `"all"` keywords, as these no longer include `ObservableQuery` instances without subscribers. +#### `skipToken` skips refetches until variables are known + + + +Although both `skip` and `skipToken` put a query in standby, `client.refetchQueries()` handles them differently before the first execution. Queries you create with `skip: true` can still be refetched because Apollo Client already has their options, including any variables that might be needed for refetching. + +Queries you create with `skipToken` are excluded until after their first execution when variables are known. This prevents situations where refetching inactive queries that contain required variables are guaranteed to fail on the server. ### Removal of the `canonizeResults` option