Skip to content

Commit

Permalink
fix(app-serverless-cms): expose graphql batching options
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel910 committed Oct 19, 2023
1 parent a828106 commit cc23cbd
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 215 deletions.
7 changes: 4 additions & 3 deletions packages/app-serverless-cms/src/apolloClientFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import { plugins } from "@webiny/plugins";
import { ApolloDynamicLink } from "@webiny/app/plugins/ApolloDynamicLink";
import { ApolloCacheObjectIdPlugin } from "@webiny/app/plugins/ApolloCacheObjectIdPlugin";

interface CreateApolloClientParams {
export interface CreateApolloClientParams {
uri: string;
batching?: Pick<BatchHttpLink.Options, "batchMax" | "batchInterval" | "batchKey">;
}
export const createApolloClient = ({ uri }: CreateApolloClientParams) => {
export const createApolloClient = ({ uri, batching }: CreateApolloClientParams) => {
return new ApolloClient({
link: ApolloLink.from([
/**
Expand All @@ -19,7 +20,7 @@ export const createApolloClient = ({ uri }: CreateApolloClientParams) => {
/**
* This batches requests made to the API to pack multiple requests into a single HTTP request.
*/
new BatchHttpLink({ uri })
new BatchHttpLink({ uri, ...batching })
]),
cache: new InMemoryCache({
addTypename: true,
Expand Down
1 change: 1 addition & 0 deletions packages/app-serverless-cms/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ export { useTenancy } from "@webiny/app-tenancy";
export type { Tenant } from "@webiny/app-tenancy";

export { AddPbWebsiteSettings } from "@webiny/app-page-builder";
export * from "./apolloClientFactory";

0 comments on commit cc23cbd

Please sign in to comment.