Skip to content

Commit baf91db

Browse files
authored
Merge pull request #21 from database-playground/pan93412/dbp-64-enable-apq-on-admin
feat(apollo): enable APQ
2 parents f57311a + 933fb75 commit baf91db

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

lib/apollo.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { HttpLink } from "@apollo/client";
22
import { ApolloClient, InMemoryCache } from "@apollo/client-integration-nextjs";
3+
import { PersistedQueryLink } from "@apollo/client/link/persisted-queries";
4+
import { sha256 } from "crypto-hash";
35
import buildUri from "./build-uri";
46

57
/**
@@ -8,6 +10,7 @@ import buildUri from "./build-uri";
810
* You should add the token to the headers of the request.
911
*/
1012
export function makeClient({ token }: { token?: string | null }) {
13+
const persistedQueryLink = new PersistedQueryLink({ sha256 });
1114
const httpLink = new HttpLink({
1215
uri: buildUri("/query"),
1316
headers: {
@@ -17,6 +20,6 @@ export function makeClient({ token }: { token?: string | null }) {
1720

1821
return new ApolloClient({
1922
cache: new InMemoryCache(),
20-
link: httpLink,
23+
link: persistedQueryLink.concat(httpLink),
2124
});
2225
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"babel-plugin-react-compiler": "19.1.0-rc.3",
3737
"class-variance-authority": "^0.7.1",
3838
"clsx": "^2.1.1",
39+
"crypto-hash": "^4.0.0",
3940
"graphql": "^16.11.0",
4041
"lucide-react": "^0.544.0",
4142
"next": "15.6.0-canary.20",

pnpm-lock.yaml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)