Skip to content

Commit

Permalink
Update packages/client-react-streaming/src/registerApolloClient.tsx
Browse files Browse the repository at this point in the history
Co-authored-by: Jerel Miller <[email protected]>
  • Loading branch information
phryneas and jerelmiller authored Feb 21, 2024
1 parent 574709b commit 491348d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/client-react-streaming/src/registerApolloClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ const seenWrappers = WeakSet
const seenClients = WeakSet ? new WeakSet<ApolloClient<any>>() : undefined;

export function registerApolloClient(makeClient: () => ApolloClient<any>) {
// this function will always create a new object
// so we can warn if `cachedMakeWrappedClient` creates a new "wrapper",
// React invalidates the cache on each server request, so the wrapping
// object is needed to properly detect whether the client is a unique
// reference or not. We can warn if `cachedMakeWrappedClient` creates a new "wrapper",
// but with a `client` property that we have already seen before.
// In that case, not every call to `makeClient` would create a new
// `ApolloClient` instance.
Expand Down

0 comments on commit 491348d

Please sign in to comment.