From 622f4c53bb692c95ccd6d93c3a58c324a6a5b00a Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Thu, 4 Apr 2024 17:50:41 +0200 Subject: [PATCH] 0.10.0 (4) default `connectToDevTools` to `false` in RSC and SSR builds (#271) --- .../WrappedApolloClient.test.tsx | 1 - .../src/DataTransportAbstraction/WrappedApolloClient.tsx | 9 ++++++++- .../client-react-streaming/src/importErrors.test.tsx | 1 - .../src/registerApolloClient.test.tsx | 1 - 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/client-react-streaming/src/DataTransportAbstraction/WrappedApolloClient.test.tsx b/packages/client-react-streaming/src/DataTransportAbstraction/WrappedApolloClient.test.tsx index 6a6ea6a6..5a645889 100644 --- a/packages/client-react-streaming/src/DataTransportAbstraction/WrappedApolloClient.test.tsx +++ b/packages/client-react-streaming/src/DataTransportAbstraction/WrappedApolloClient.test.tsx @@ -108,7 +108,6 @@ describe( const link = new MockSubscriptionLink(); const client = new ApolloClient({ - connectToDevTools: false, cache: new InMemoryCache(), link, }); diff --git a/packages/client-react-streaming/src/DataTransportAbstraction/WrappedApolloClient.tsx b/packages/client-react-streaming/src/DataTransportAbstraction/WrappedApolloClient.tsx index a59cc9f9..b8198892 100644 --- a/packages/client-react-streaming/src/DataTransportAbstraction/WrappedApolloClient.tsx +++ b/packages/client-react-streaming/src/DataTransportAbstraction/WrappedApolloClient.tsx @@ -49,7 +49,14 @@ class ApolloClientBase extends OrigApolloClient { static readonly info = bundle; constructor(options: ApolloClientOptions) { - super(options); + super( + process.env.REACT_ENV === "rsc" || process.env.REACT_ENV === "ssr" + ? { + connectToDevTools: false, + ...options, + } + : options + ); if (!(this.cache instanceof InMemoryCache)) { throw new Error( diff --git a/packages/client-react-streaming/src/importErrors.test.tsx b/packages/client-react-streaming/src/importErrors.test.tsx index 7db8d95e..8c1a8bf2 100644 --- a/packages/client-react-streaming/src/importErrors.test.tsx +++ b/packages/client-react-streaming/src/importErrors.test.tsx @@ -37,7 +37,6 @@ test( // @ts-expect-error we want to test exactly this new upstreamPkg.ApolloClient({ cache: new upstreamPkg.InMemoryCache(), - connectToDevTools: false, }), children: null, }) diff --git a/packages/client-react-streaming/src/registerApolloClient.test.tsx b/packages/client-react-streaming/src/registerApolloClient.test.tsx index a78c6a7d..5506040a 100644 --- a/packages/client-react-streaming/src/registerApolloClient.test.tsx +++ b/packages/client-react-streaming/src/registerApolloClient.test.tsx @@ -53,7 +53,6 @@ function drain(stream: ReturnType) { function makeClient() { return new ApolloClient({ cache: new InMemoryCache(), - connectToDevTools: false, }); }