-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reproduction: use Apollo Client in a RSC
it gets bundled into the Client Chunks
- Loading branch information
Showing
5 changed files
with
202 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { HttpLink } from "@apollo/client"; | ||
import { | ||
registerApolloClient, | ||
ApolloClient, | ||
InMemoryCache, | ||
} from "@apollo/experimental-nextjs-app-support"; | ||
|
||
export const { getClient, query, PreloadQuery } = registerApolloClient(() => { | ||
return new ApolloClient({ | ||
cache: new InMemoryCache(), | ||
link: new HttpLink({ | ||
// this needs to be an absolute url, as relative urls cannot be used in SSR | ||
uri: "http://example.com/api/graphql", | ||
// you can disable result caching here if you want to | ||
// (this does not work if you are rendering your page with `export const dynamic = "force-static"`) | ||
// fetchOptions: { cache: "no-store" }, | ||
}), | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"use client"; | ||
|
||
export function ClientComponent() { | ||
return <div>Hi</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters