@apollo/client-react-streaming
Version:
This package provides building blocks to create framework-level integration of Apollo Client with React's streaming SSR. See the [@apollo/client-integration-nextjs](https://github.com/apollographql/apollo-client-integrations/tree/main/packages/nextjs) pac
60 lines • 2.1 kB
TypeScript
import { ApolloLink } from "@apollo/client";
interface RemoveMultipartDirectivesConfig {
/**
* Whether to strip fragments with `@defer` directives
* from queries before sending them to the server.
*
* Defaults to `true`.
*
* Can be overwritten by adding a label starting
* with either `"SsrDontStrip"` or `"SsrStrip"` to the
* directive.
*/
stripDefer?: boolean;
}
/**
* This link will (if called with `stripDefer: true`) strip all `@defer` fragments from your query.
*
* This is used to prevent the server from doing additional work in SSR scenarios where multipart responses cannot be handled anyways.
*
* You can exclude certain fragments from this behavior by giving them a label starting with `"SsrDontStrip"`.
* The "starting with" is important, because labels have to be unique per operation. So if you have multiple directives where you want to override the default stipping behaviour,
* you can do this by annotating them like
* ```graphql
* query myQuery {
* fastField
* ... @defer(label: "SsrDontStrip1") {
* slowField1
* }
* ... @defer(label: "SsrDontStrip2") {
* slowField2
* }
* }
* ```
*
* You can also use the link with `stripDefer: false` and mark certain fragments to be stripped by giving them a label starting with `"SsrStrip"`.
*
* @example
* ```ts
* new RemoveMultipartDirectivesLink({
* // Whether to strip fragments with `@defer` directives
* // from queries before sending them to the server.
* //
* // Defaults to `true`.
* //
* // Can be overwritten by adding a label starting
* // with either `"SsrDontStrip"` or `"SsrStrip"` to the
* // directive.
* stripDefer: true,
* });
* ```
*
* @public
*/
export declare class RemoveMultipartDirectivesLink extends ApolloLink {
private stripDirectives;
constructor(config: RemoveMultipartDirectivesConfig);
request(operation: ApolloLink.Operation, forward?: ApolloLink.ForwardFunction): import("rxjs").Observable<{}>;
}
export {};
//# sourceMappingURL=RemoveMultipartDirectivesLink.d.ts.map