Releases: apollographql/apollo-client-nextjs
v.0.11.7: React 19 π
v.0.11.6: fix a bundling issue
This release fixes a bundling issue where the graphql
package was partially inlined in the bundle of @apollo/client-react-streaming
. Updating to this version should reduce your bundle size.
v.0.11.5: Next.js 15
What's Changed
Full Changelog: v.0.11.4...v.0.11.5
v.0.11.4: warn on `ssrMode`, more resilient data transport
What's Changed
- make the hook hydration cache resilient against unmounted recreation of
ManualDataTransport
by @phryneas in #375 - Warn if
ssrMode
orssrForceFetchDelay
are used. by @phryneas in #358
Full Changelog: v.0.11.3...v.0.11.4
v.0.11.3: remove `queryRef.toPromise()`, lazily load `SimulatePreloadedQuery`
v0.11.2: export additional `PreloadQuery`-related types
What's Changed
Full Changelog: v.0.11.1...v.0.11.2
v0.11.1: type fix for `PreloadQuery`
This release just fixes the TypeScript type of PreloadQuery
What's Changed
- Update README links to point to non-experimental hooks links by @jer-k in #309
- Use \ instead of double spaces to add line breaks by @jer-k in #310
- more explicit
PreloadQuery
return type by @phryneas in #313
New Contributors
Full Changelog: v.0.11.0...v.0.11.1
v0.11.0: Prefetching in RSC, renaming exports, Next.js 15, less transported data, `@apollo/client-react-streaming/stream-utils`
Prefetching queries for Client Components in RSC
Calling registerApolloClient
in RSC now also returns a PrefetchQuery
component that can be used to prefetch queries in RSC to seed the Client Component cache.
Usage looks like
<PreloadQuery
query={QUERY}
variables={{
foo: 1,
}}
>
<Suspense fallback={<>loading</>}>
<ClientChild />
</Suspense>
</PreloadQuery>
Client Components further down in the component tree can continue using useSuspenseQuery
with the same QUERY
to retrieve that data.
"use client";
import { useSuspenseQuery } from "@apollo/client";
// ...
export function ClientChild() {
const { data } = useSuspenseQuery(QUERY);
return <div>...</div>;
}
This also works with QueryRefs
for usage with useReadQuery
in Client Components.
For more details, see the new documentation at
https://github.com/apollographql/apollo-client-nextjs/tree/main?tab=readme-ov-file#preloading-data-in-rsc-for-usage-in-client-components
Renamed exports
In the past, the @apollo/experimental-nextjs-app-support
package had two entry points, /rsc
and /ssr
.
This has caused a lot of confusion, and both entry points have been moved together into the base entry point, @apollo/experimental-nextjs-app-support
.
On top of that, the Apollo Client React hooks (useQuery
, useSuspenseQuery
, etc.) no longer need to be imported from @apollo/experimental-nextjs-app-support
, but they can be imported directly from @apollo/client
now, while still being streaming-compatible.
Also, a few exports have been renamed:
NextSSRApolloClient
->ApolloClient
NextSSRInMemoryCache
->InMemoryCache
resetNextSSRApolloSingletons
->resetApolloClientSingletons
The old entry points with the old exports still exist and each of them has a @deprecated
docblock explaining the new import to use.
Next.js 15 support
next@15-rc
has been added to the peerDependencies
, so this package can now be used with Next.js 15.
Thank you for the PR, @nphmuller!
Less transported data
In the past, we used the superjson
package to serialize data to be transported from streaming SSR into the browser.
This package is great to allow values like undefined
, circular references, and built-in class instances, like Date
s.
Unfortunately, though, this adds a lot of metadata to the transported data.
Since the data we need to transport is already JSON-serializable and we only need a bit of extra handling for undefined
, the SuperJSON dependency has been replaced with a more custom approach.
This considerably reduces the amount of data transported.
If you have custom non-serializable data that needs to be transported, you can provide custom stringify
and revive
functions.
On top of that, we now transport a minified version of the Query, which saves additional data.
@apollo/client-react-streaming/stream-utils
We have added a new entry point, @apollo/client-react-streaming/stream-utils
, which exports helper functions you can use to integrate Apollo Client with custom streaming SSR setups with renderToReadableStream
and renderToPipeableStream
, e.g., in Vite.
We are still working on documentation for this feature, but you can already take a peek at https://deploy-preview-11807--apollo-client-docs.netlify.app/ssr-and-rsc/custom-streaming-ssr.
What's Changed
- remove superjson dependency by @phryneas in #274
- Transport minified version of query. by @phryneas in #277
- add stream-utils sub-import by @phryneas in #294
- update dependencies by @phryneas in #297
- RSC preloading mechanism by @phryneas in #258
- add shared
@apollo/experimental-nextjs-app-support
entry point by @phryneas in #300 - Support next@15.0.0-rc.0 by @nphmuller in #304
- Use a symbol property instead of instanceOf to check for correct ApolloClient/InMemoryCache by @phryneas in #302
- Add deprecation messages to moved exports. by @phryneas in #301
- update README to include PreloadQuery by @phryneas in #303
New Contributors
- @nphmuller made their first contribution in #304
Full Changelog: v.0.10.1...v.0.11.0
v.0.10.1 Allow using the browser build of `ApolloNextAppProvider` outside of Next.js, e.g. for tests.
What's Changed
- Allow using the browser build of
ApolloNextAppProvider
outside of Next.js, e.g. for tests. by @phryneas in #284
Full Changelog: v.0.10.0...v.0.10.1
v.0.10.0: optimize hydration render, prevent common error scenarios
What's Changed
- 0.10.0 (1) - Throw error when passing arguments into
getClient
. by @phryneas in #203 - 0.10.0 (2) - Warn if makeClient returns the same client for multiple requests. by @phryneas in #205
- 0.10.0 (3) switch rehydration mismatch protection to
useSyncExternalStore
by @phryneas in #207 - 0.10.0 (4) default
connectToDevTools
tofalse
in RSC and SSR builds by @phryneas in #271
Full Changelog: v.0.9.2...v.0.10.0