Skip to content

Conversation

@jerelmiller
Copy link
Member

Opening this PR to allow for comments. We'll close this once we are happy with the content and port it over to the blog.

jerelmiller and others added 6 commits August 6, 2025 20:40
Removes puffery and adds some context for readers
* Add React Compiler section
* Clarify some existing parts of release-notes.md
@changeset-bot
Copy link

changeset-bot bot commented Aug 19, 2025

⚠️ No Changeset found

Latest commit: 7045de5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 19, 2025

npm i https://pkg.pr.new/apollographql/apollo-client/@apollo/client@12852

commit: 7045de5

@github-actions
Copy link
Contributor

github-actions bot commented Aug 19, 2025

size-limit report 📦

Path Size
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (CJS) 42.9 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (production) (CJS) 37.8 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" 32.84 KB (0%)
import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client" (production) 27.03 KB (0%)
import { ApolloProvider } from "@apollo/client/react" 5.91 KB (0%)
import { ApolloProvider } from "@apollo/client/react" (production) 970 B (0%)
import { useQuery } from "@apollo/client/react" 7.22 KB (0%)
import { useQuery } from "@apollo/client/react" (production) 2.23 KB (0%)
import { useLazyQuery } from "@apollo/client/react" 7.1 KB (0%)
import { useLazyQuery } from "@apollo/client/react" (production) 2.14 KB (0%)
import { useMutation } from "@apollo/client/react" 6.46 KB (0%)
import { useMutation } from "@apollo/client/react" (production) 1.48 KB (0%)
import { useSubscription } from "@apollo/client/react" 6.77 KB (0%)
import { useSubscription } from "@apollo/client/react" (production) 1.79 KB (0%)
import { useSuspenseQuery } from "@apollo/client/react" 8.56 KB (0%)
import { useSuspenseQuery } from "@apollo/client/react" (production) 3.62 KB (0%)
import { useBackgroundQuery } from "@apollo/client/react" 8.32 KB (0%)
import { useBackgroundQuery } from "@apollo/client/react" (production) 3.38 KB (0%)
import { useLoadableQuery } from "@apollo/client/react" 8.28 KB (0%)
import { useLoadableQuery } from "@apollo/client/react" (production) 3.36 KB (0%)
import { useReadQuery } from "@apollo/client/react" 6.58 KB (0%)
import { useReadQuery } from "@apollo/client/react" (production) 1.63 KB (0%)
import { useFragment } from "@apollo/client/react" 6.68 KB (0%)
import { useFragment } from "@apollo/client/react" (production) 1.71 KB (0%)

@apollo-librarian
Copy link

apollo-librarian bot commented Aug 19, 2025

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

26 new, 66 changed, 5 removed
+ (developer-tools)/react/(latest)/api/link/apollo-link-base-batch-http.mdx
+ (developer-tools)/react/(latest)/api/link/apollo-link-base-http.mdx
+ (developer-tools)/react/(latest)/api/link/apollo-link-batch.mdx
+ (developer-tools)/react/(latest)/api/link/apollo-link-client-awareness.mdx
+ (developer-tools)/react/(latest)/api/link/apollo-link.mdx
+ (developer-tools)/react/(latest)/api/react/ApolloProvider.mdx
+ (developer-tools)/react/(latest)/api/react/skipToken.mdx
+ (developer-tools)/react/(latest)/api/react/useApolloClient.mdx
+ (developer-tools)/react/(latest)/api/react/useBackgroundQuery.mdx
+ (developer-tools)/react/(latest)/api/react/useFragment.mdx
+ (developer-tools)/react/(latest)/api/react/useLazyQuery.mdx
+ (developer-tools)/react/(latest)/api/react/useLoadableQuery.mdx
+ (developer-tools)/react/(latest)/api/react/useMutation.mdx
+ (developer-tools)/react/(latest)/api/react/useQuery.mdx
+ (developer-tools)/react/(latest)/api/react/useQueryRefHandlers.mdx
+ (developer-tools)/react/(latest)/api/react/useReactiveVar.mdx
+ (developer-tools)/react/(latest)/api/react/useReadQuery.mdx
+ (developer-tools)/react/(latest)/api/react/useSubscription.mdx
+ (developer-tools)/react/(latest)/api/react/useSuspenseQuery.mdx
+ (developer-tools)/react/(latest)/api/errors/CombinedGraphQLErrors.mdx
+ (developer-tools)/react/(latest)/api/errors/CombinedProtocolErrors.mdx
+ (developer-tools)/react/(latest)/api/errors/LinkError.mdx
+ (developer-tools)/react/(latest)/api/errors/LocalStateError.mdx
+ (developer-tools)/react/(latest)/api/errors/ServerError.mdx
+ (developer-tools)/react/(latest)/api/errors/ServerParseError.mdx
+ (developer-tools)/react/(latest)/api/errors/UnconventionalError.mdx
* (developer-tools)/react/(latest)/get-started.mdx
* (developer-tools)/react/(latest)/index.mdx
* (developer-tools)/react/(latest)/why-apollo.mdx
* (developer-tools)/react/(latest)/api/cache/InMemoryCache.mdx
* (developer-tools)/react/(latest)/api/core/ApolloClient.mdx
* (developer-tools)/react/(latest)/api/core/ObservableQuery.mdx
* (developer-tools)/react/(latest)/api/link/apollo-link-batch-http.mdx
* (developer-tools)/react/(latest)/api/link/apollo-link-context.mdx
* (developer-tools)/react/(latest)/api/link/apollo-link-error.mdx
* (developer-tools)/react/(latest)/api/link/apollo-link-http.mdx
* (developer-tools)/react/(latest)/api/link/apollo-link-remove-typename.mdx
* (developer-tools)/react/(latest)/api/link/apollo-link-retry.mdx
* (developer-tools)/react/(latest)/api/link/apollo-link-schema.mdx
* (developer-tools)/react/(latest)/api/link/apollo-link-subscriptions.mdx
* (developer-tools)/react/(latest)/api/link/apollo-link-ws.mdx
* (developer-tools)/react/(latest)/api/link/community-links.mdx
* (developer-tools)/react/(latest)/api/link/introduction.mdx
* (developer-tools)/react/(latest)/api/link/persisted-queries.mdx
* (developer-tools)/react/(latest)/api/react/hooks.mdx
* (developer-tools)/react/(latest)/api/react/preloading.mdx
* (developer-tools)/react/(latest)/api/react/ssr.mdx
* (developer-tools)/react/(latest)/api/react/testing.mdx
* (developer-tools)/react/(latest)/caching/advanced-topics.mdx
* (developer-tools)/react/(latest)/caching/cache-configuration.mdx
* (developer-tools)/react/(latest)/caching/cache-field-behavior.mdx
* (developer-tools)/react/(latest)/caching/cache-interaction.mdx
* (developer-tools)/react/(latest)/caching/garbage-collection.mdx
* (developer-tools)/react/(latest)/caching/memory-management.mdx
* (developer-tools)/react/(latest)/caching/overview.mdx
* (developer-tools)/react/(latest)/data/defer.mdx
* (developer-tools)/react/(latest)/data/directives.mdx
* (developer-tools)/react/(latest)/data/document-transforms.mdx
* (developer-tools)/react/(latest)/data/error-handling.mdx
* (developer-tools)/react/(latest)/data/file-uploads.mdx
* (developer-tools)/react/(latest)/data/fragments.mdx
* (developer-tools)/react/(latest)/data/mutations.mdx
* (developer-tools)/react/(latest)/data/operation-best-practices.mdx
* (developer-tools)/react/(latest)/data/queries.mdx
* (developer-tools)/react/(latest)/data/refetching.mdx
* (developer-tools)/react/(latest)/data/subscriptions.mdx
* (developer-tools)/react/(latest)/data/suspense.mdx
* (developer-tools)/react/(latest)/development-testing/client-schema-mocking.mdx
* (developer-tools)/react/(latest)/development-testing/developer-tooling.mdx
* (developer-tools)/react/(latest)/development-testing/schema-driven-testing.mdx
* (developer-tools)/react/(latest)/development-testing/static-typing.mdx
* (developer-tools)/react/(latest)/development-testing/testing.mdx
* (developer-tools)/react/(latest)/integrations/integrations.mdx
* (developer-tools)/react/(latest)/integrations/react-native.mdx
* (developer-tools)/react/(latest)/integrations/webpack.mdx
* (developer-tools)/react/(latest)/local-state/local-resolvers.mdx
* (developer-tools)/react/(latest)/local-state/local-state-management.mdx
* (developer-tools)/react/(latest)/local-state/managing-state-with-field-policies.mdx
* (developer-tools)/react/(latest)/local-state/reactive-variables.mdx
* (developer-tools)/react/(latest)/migrating/apollo-client-3-migration.mdx
* (developer-tools)/react/(latest)/networking/advanced-http-networking.mdx
* (developer-tools)/react/(latest)/networking/authentication.mdx
* (developer-tools)/react/(latest)/networking/basic-http-networking.mdx
* (developer-tools)/react/(latest)/pagination/core-api.mdx
* (developer-tools)/react/(latest)/pagination/cursor-based.mdx
* (developer-tools)/react/(latest)/pagination/key-args.mdx
* (developer-tools)/react/(latest)/pagination/offset-based.mdx
* (developer-tools)/react/(latest)/performance/babel.mdx
* (developer-tools)/react/(latest)/performance/optimistic-ui.mdx
* (developer-tools)/react/(latest)/performance/performance.mdx
* (developer-tools)/react/(latest)/performance/server-side-rendering.mdx
* (developer-tools)/react/(latest)/_sidebar.yaml
- (developer-tools)/react/(latest)/api/link/apollo-link-rest.mdx
- (developer-tools)/react/(latest)/api/react/components.mdx
- (developer-tools)/react/(latest)/api/react/hoc.mdx
- (developer-tools)/react/(latest)/local-state/client-side-schema.mdx
- (developer-tools)/react/(latest)/migrating/hooks-migration.mdx

Build ID: 6dc0572e2d09117b5d69a740
Build Logs: View logs

URL: https://www.apollographql.com/docs/deploy-preview/6dc0572e2d09117b5d69a740

Copy link
Member Author

@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.

@bignimbus I'll review this more in depth after I get through the migration guide, but posted a couple quick thoughts after skimming through.


## Dramatically Smaller Bundles

Bundle size has been a top concern in community feedback, and we've taken it seriously. Apollo Client 4.0 introduces opt-in architecture for features that not everyone needs. The most impactful change is making local state management opt-in. If you're not using `@client` directives for local state, you no longer carry that code in your bundle. When you do need it, importing `LocalState` from `@apollo/client/local-state` gives you the same powerful local state management you're used to, but only when you actually use it.
Copy link
Member Author

Choose a reason for hiding this comment

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

LocalState is a big one, but there are a few others that also got this treatment that impact bundle size because the implementation can be tree-shaken away (HttpLink is another example, it is no longer bundled with ApolloClient if you're using a different termininating link). Does it make sense to focus just on local state here, or should we make it a more general statement? That said, local state is the biggest contributor to this pattern 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Made an edit to allow for more nuance here, does that seem closer to what we're looking for?


We've also modernized our build targets. Apollo Client 4.0 ships JavaScript transpiled for browsers from 2023 and Node.js 20+, taking advantage of native language features instead of polyfills. Combined with proper ESM support and improved tree-shaking, most applications will see a **20-30%** reduction in Apollo Client's bundle size contribution. For teams fighting to stay under performance budgets, this improvement alone makes upgrading worthwhile.

## TypeScript That Helps
Copy link
Member Author

Choose a reason for hiding this comment

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

A BIG part of the TypeScript story in 4.0 is the enforcement of required variables, the addition of type overrides, and defining context types for the link chain. I think we should try and mention these as well. Now that we have the TypeScript guide merged, check out the new doc for more information:

I would definitely leave what you have in here since it is the other big piece of the TypeScript story, but if we can find a way to mention these as well, that would be awesome.

Copy link
Contributor

Choose a reason for hiding this comment

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

Pushed an update that elaborates on the TS story - lmk what you think!

Co-authored-by: Lenz Weber-Tronic <[email protected]>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants