From 061cab6627abd4ec81f83c40c1d281c418627c93 Mon Sep 17 00:00:00 2001
From: Jerel Miller <jerelmiller@gmail.com>
Date: Tue, 23 Jul 2024 08:20:30 -0600
Subject: [PATCH] Fix incorrect default devtools config (#11969)

---
 .changeset/early-spoons-attack.md | 5 +++++
 .size-limits.json                 | 4 ++--
 src/core/ApolloClient.ts          | 5 +----
 3 files changed, 8 insertions(+), 6 deletions(-)
 create mode 100644 .changeset/early-spoons-attack.md

diff --git a/.changeset/early-spoons-attack.md b/.changeset/early-spoons-attack.md
new file mode 100644
index 00000000000..fd674e2637b
--- /dev/null
+++ b/.changeset/early-spoons-attack.md
@@ -0,0 +1,5 @@
+---
+"@apollo/client": patch
+---
+
+Remove check for `window.__APOLLO_CLIENT__` when determining whether to connect to Apollo Client Devtools when `connectToDevtools` or `devtools.enabled` is not specified. This now simply checks to see if the application is in development mode.
diff --git a/.size-limits.json b/.size-limits.json
index 3b2a83ce94c..25219697037 100644
--- a/.size-limits.json
+++ b/.size-limits.json
@@ -1,4 +1,4 @@
 {
-  "dist/apollo-client.min.cjs": 40179,
-  "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32990
+  "dist/apollo-client.min.cjs": 40164,
+  "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32977
 }
diff --git a/src/core/ApolloClient.ts b/src/core/ApolloClient.ts
index b9c5c7883fc..6070591ffd9 100644
--- a/src/core/ApolloClient.ts
+++ b/src/core/ApolloClient.ts
@@ -258,10 +258,7 @@ export class ApolloClient<TCacheShape> implements DataProxy {
     };
 
     if (this.devtoolsConfig.enabled === undefined) {
-      this.devtoolsConfig.enabled =
-        typeof window === "object" &&
-        (window as any).__APOLLO_CLIENT__ &&
-        __DEV__;
+      this.devtoolsConfig.enabled = __DEV__;
     }
 
     if (ssrForceFetchDelay) {