This repository has been archived by the owner on Jul 20, 2024. It is now read-only.
[Snyk] Upgrade @apollo/experimental-nextjs-app-support from 0.10.1 to 0.11.0 #618
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR was automatically created by Snyk using the credentials of a real user.
![snyk-top-banner](https://github.com/andygongea/OWASP-Benchmark/assets/818805/c518c423-16fe-447e-b67f-ad5a49b5d123)
Snyk has created this PR to upgrade @apollo/experimental-nextjs-app-support from 0.10.1 to 0.11.0.
ℹ️ Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.
The recommended version is 1 version ahead of your current version.
The recommended version was released on a month ago.
Release notes
Package name: @apollo/experimental-nextjs-app-support
Prefetching queries for Client Components in RSC
Calling
registerApolloClient
in RSC now also returns aPrefetchQuery
component that can be used to prefetch queries in RSC to seed the Client Component cache.Usage looks like
Client Components further down in the component tree can continue using
useSuspenseQuery
with the sameQUERY
to retrieve that data.import { useSuspenseQuery } from "@ apollo/client";
// ...
export function ClientChild() {
const { data } = useSuspenseQuery(QUERY);
return <div>...</div>;
}
This also works with
QueryRefs
for usage withuseReadQuery
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 thepeerDependencies
, 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, likeDate
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
andrevive
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 withrenderToReadableStream
andrenderToPipeableStream
, 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
@ apollo/experimental-nextjs-app-support
entry point by @ phryneas in #300New Contributors
Full Changelog: v.0.10.1...v.0.11.0
What's Changed
ApolloNextAppProvider
outside of Next.js, e.g. for tests. by @ phryneas in #284Full Changelog: v.0.10.0...v.0.10.1
Important
Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.
For more information: