apollo-client-nextjs: `NextSSRInMemoryCache` is not exported by `@apollo/experimental-nextjs-app-support/ssr`
In node_modules/.pnpm/@apollo+experimental-nextjs-app-support@0.9.1_@apollo+client@3.9.10_next@14.1.4_react@18.2.0/node_modules/@apollo/experimental-nextjs-app-support/dist/ssr/index.ssr.js
import { useContext } from 'react';
import { buildManualDataTransport } from '@apollo/client-react-streaming/manual-transport';
export { resetManualSSRApolloSingletons as resetNextSSRApolloSingletons } from '@apollo/client-react-streaming/manual-transport';
import { WrapApolloProvider, ApolloClient } from '@apollo/client-react-streaming';
export { DebounceMultipartResponsesLink, InMemoryCache as NextSSRInMemoryCache, RemoveMultipartDirectivesLink, SSRMultipartLink } from '@apollo/client-react-streaming';
import { ServerInsertedHTMLContext } from 'next/navigation.js';
export { useBackgroundQuery, useFragment, useQuery, useReadQuery, useSuspenseQuery } from '@apollo/client/index.js';
// src/ApolloNextAppProvider.ts
// src/bundleInfo.ts
var bundle = {
pkg: "@apollo/experimental-nextjs-app-support/ssr",
client: "NextSSRApolloClient",
cache: "NextSSRInMemoryCache"
};
// src/ApolloNextAppProvider.ts
var ApolloNextAppProvider = /* @__PURE__ */ WrapApolloProvider(
buildManualDataTransport({
useInsertHtml() {
const insertHtml = useContext(ServerInsertedHTMLContext);
if (!insertHtml) {
throw new Error(
"ApolloNextAppProvider cannot be used outside of the Next App Router!"
);
}
return insertHtml;
}
})
);
ApolloNextAppProvider.info = bundle;
var NextSSRApolloClient = class extends ApolloClient {
/**
* Information about the current package and it's export names, for use in error messages.
*
* @internal
*/
static info = bundle;
};
export { ApolloNextAppProvider, NextSSRApolloClient };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.ssr.js.map
NextSSRInMemoryCache is not exported.
I am using version 0.9.1
About this issue
- Original URL
- State: open
- Created 3 months ago
- Comments: 21 (12 by maintainers)
Commits related to this issue
- Update README to fix issue #262 — committed to nodegin/apollo-client-nextjs by deleted user 3 months ago
Yup. That, or you just use
useSuspenseQuery
in a client component, which will fetch the data in SSR, not RSC - but only on the first request, not on further navigation. (That’s what you’ll be using RSC+PreloadQuery from #258 for)The same issue occurs when importing registerApolloClient
import { registerApolloClient } from "@apollo/experimental-nextjs-app-support/rsc";
just copy pasted the example from the github readme
export const { getClient } = registerApolloClient(() => { return new ApolloClient({ ... }) }