Skip to content

Conversation

@phryneas
Copy link
Member

@phryneas phryneas commented Apr 2, 2025

@changeset-bot
Copy link

changeset-bot bot commented Apr 2, 2025

🦋 Changeset detected

Latest commit: 19ef2c9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@apollo/client Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@svc-apollo-docs
Copy link

svc-apollo-docs commented Apr 2, 2025

⚠️ Docs preview not attached to branch

The preview was not built because the PR's base branch release-4.0 is not in the list of sources.

An Apollo team member can comment one of the following commands to dictate which branch to attach the preview to:

  • !docs set-base-branch version-2.6
  • !docs set-base-branch main

Build ID: 730ad61b0e9297ceae71e415

@pkg-pr-new
Copy link

pkg-pr-new bot commented Apr 2, 2025

npm i https://pkg.pr.new/@apollo/client@12513

commit: 69636a3

@github-actions
Copy link
Contributor

github-actions bot commented Apr 2, 2025

size-limit report 📦

Path Size
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (CJS) 41.82 KB (-0.32% 🔽)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (production) (CJS) 37.46 KB (+0.09% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" 31.97 KB (-0.67% 🔽)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (production) 27.1 KB (+0.09% 🔺)
import { ApolloProvider } from "@apollo/client/react" 5.03 KB (-4.4% 🔽)
import { ApolloProvider } from "@apollo/client/react" (production) 962 B (-0.42% 🔽)
import { useQuery } from "@apollo/client/react" 6.31 KB (-11.1% 🔽)
import { useQuery } from "@apollo/client/react" (production) 2.2 KB (-20.42% 🔽)
import { useLazyQuery } from "@apollo/client/react" 6.26 KB (-3.89% 🔽)
import { useLazyQuery } from "@apollo/client/react" (production) 2.17 KB (-0.14% 🔽)
import { useMutation } from "@apollo/client/react" 5.63 KB (-12.78% 🔽)
import { useMutation } from "@apollo/client/react" (production) 1.53 KB (-27.69% 🔽)
import { useSubscription } from "@apollo/client/react" 5.92 KB (-12.07% 🔽)
import { useSubscription } from "@apollo/client/react" (production) 1.82 KB (-24.33% 🔽)
import { useSuspenseQuery } from "@apollo/client/react" 7.68 KB (-7.55% 🔽)
import { useSuspenseQuery } from "@apollo/client/react" (production) 3.58 KB (-10.55% 🔽)
import { useBackgroundQuery } from "@apollo/client/react" 7.49 KB (-8.12% 🔽)
import { useBackgroundQuery } from "@apollo/client/react" (production) 3.42 KB (-11.01% 🔽)
import { useLoadableQuery } from "@apollo/client/react" 7.51 KB (-7.92% 🔽)
import { useLoadableQuery } from "@apollo/client/react" (production) 3.44 KB (-10.98% 🔽)
import { useReadQuery } from "@apollo/client/react" 5.71 KB (-3.81% 🔽)
import { useReadQuery } from "@apollo/client/react" (production) 1.61 KB (-0.31% 🔽)
import { useFragment } from "@apollo/client/react" 5.76 KB (-3.93% 🔽)
import { useFragment } from "@apollo/client/react" (production) 1.68 KB (-0.12% 🔽)

@jerelmiller jerelmiller force-pushed the pr/use-more-offical-exports-in-tests branch from 40999b8 to d176cbd Compare April 2, 2025 20:17
Base automatically changed from pr/use-more-offical-exports-in-tests to release-4.0 April 2, 2025 20:31
@jerelmiller jerelmiller force-pushed the pr/remove-some-react-entrypoints branch from 98ade11 to d3dc528 Compare April 2, 2025 20:36
@netlify
Copy link

netlify bot commented Apr 2, 2025

Deploy Preview for apollo-client-docs ready!

Name Link
🔨 Latest commit 69636a3
🔍 Latest deploy log https://app.netlify.com/sites/apollo-client-docs/deploys/67ee4ef4a5e80e0008442aef
😎 Deploy Preview https://deploy-preview-12513--apollo-client-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Comment on lines -68 to -74
invariant(
!!document && !!document.kind,
`Argument of %s passed to parser was not a valid GraphQL ` +
`DocumentNode. You may need to use 'graphql-tag' or another method ` +
`to convert your operation into a document`,
document
);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Covered by

invariant(
doc && doc.kind === "Document",
`Expecting a parsed GraphQL document. Perhaps you need to wrap the query \
string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql`
);

Comment on lines -111 to -121
invariant(
queries.length + mutations.length + subscriptions.length <= 1,
`react-apollo only supports a query, subscription, or a mutation per HOC. ` +
`%s had %s queries, %s ` +
`subscriptions and %s mutations. ` +
`You can use 'compose' to join multiple operation types to a component`,
document,
queries.length,
subscriptions.length,
mutations.length
);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Covered by

invariant(
operations.length <= 1,
`Ambiguous GraphQL document: contains %s operations`,
operations.length
);

Comment on lines -131 to -138
invariant(
definitions.length === 1,
`react-apollo only supports one definition per HOC. %s had ` +
`%s definitions. ` +
`You can use 'compose' to join multiple operation types to a component`,
document,
definitions.length
);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also covered by

invariant(
operations.length <= 1,
`Ambiguous GraphQL document: contains %s operations`,
operations.length
);

@phryneas phryneas changed the title remove react/context|hooks|parser entry points, move verifyDocumentType to utilities remove react/context|hooks|parser entry points, remove parser utils completely Apr 3, 2025
Comment on lines -166 to -172
invariant(
operation.type === type,
`Running a %s requires a graphql ` + `%s, but a %s was used instead.`,
requiredOperationName,
requiredOperationName,
usedOperationName
);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a new optional check here:

>
): useMutation.ResultTuple<TData, TVariables, TContext, TCache> {
const client = useApolloClient(options?.client);
verifyDocumentType(mutation, DocumentType.Mutation);
Copy link
Member Author

@phryneas phryneas Apr 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These checks all moved into QueryManager, and since they now are not executed on every render, but only if an operation is started, they also don't need caching.

Comment on lines -280 to -285
"operationName",
"parser",
"useApolloClient",
"useBackgroundQuery",
"useFragment",
"useLazyQuery",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This diff is not really nice, it looks like "removed" here and then merges in a removed entry point with the same exports further down.


const { hasOwnProperty } = Object.prototype;

// TODO(brian): A hack until this issue is resolved (https://github.com/graphql/graphql-js/issues/3356)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means we have to drop GraphQL 15 compat, which we probably should do anyways.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +9 to +12
declare namespace ApolloConsumer {
export interface Props {
children: (client: ApolloClient) => ReactTypes.ReactNode;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was previously exported from /react/context, but not from /react. I don't want to add more noise to /react, and this keeps it available for use from the outside.

Same for ApolloProvider.

Copy link
Member

@jerelmiller jerelmiller Apr 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be called out in the changelog?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tbh., I don't think anyone ever used those - it would probably be more noise than it would be worth.

@phryneas phryneas marked this pull request as ready for review April 3, 2025 09:03
@phryneas phryneas requested a review from jerelmiller April 3, 2025 09:03
} from "@apollo/client/core";
import { createPersistedQueryLink } from "@apollo/client/link/persisted-queries";
import { removeTypenameFromVariables } from "@apollo/client/link/remove-typename";
// importing react so the `parser` cache initializes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice to see this gone 🎉


// Checks the document for errors and throws an exception if there is an error.
export function checkDocument(doc: DocumentNode) {
export function checkDocument(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a good candidate to move to utilities/internal. Adding this as a reminder to do in #12194

Copy link
Member

@jerelmiller jerelmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@github-actions github-actions bot added the auto-cleanup 🤖 label Apr 3, 2025
@phryneas phryneas merged commit 9c3207c into release-4.0 Apr 3, 2025
57 checks passed
@phryneas phryneas deleted the pr/remove-some-react-entrypoints branch April 3, 2025 15:50
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants