Skip to content

Commit 986a441

Browse files
committed
Add some doc blocks to retry link
1 parent 3abc71f commit 986a441

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

src/link/retry/retryLink.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import type { RetryFunction, RetryFunctionOptions } from "./retryFunction.js";
1414
import { buildRetryFunction } from "./retryFunction.js";
1515

1616
export declare namespace RetryLink {
17+
/**
18+
* Options provided to the `RetryLink` constructor.
19+
*/
1720
export interface Options {
1821
/**
1922
* Configuration for the delay strategy to use, or a custom delay strategy.
@@ -104,6 +107,31 @@ class RetryableOperation {
104107
}
105108
}
106109

110+
/**
111+
* `RetryLink` is a non-terminating link that attempts to retry operations that
112+
* fail due to network errors. It enables resilient GraphQL operations by
113+
* automatically retrying failed requests with configurable delay and retry
114+
* strategies.
115+
*
116+
* @remarks
117+
*
118+
* `RetryLink` is particularly useful for handling unreliable network conditions
119+
* where you would rather wait longer than explicitly fail an operation. It
120+
* provides exponential backoff and jitters delays between attempts by default.
121+
*
122+
* > [!NOTE]
123+
* > This link does not handle retries for GraphQL errors in the response. Use
124+
* > `ErrorLink` to retry an operation after a GraphQL error. For more
125+
* > information, see the [Error handling documentation](https://apollographql.com/docs/react/data/error-handling#on-graphql-errors).
126+
*
127+
* @example
128+
*
129+
* ```ts
130+
* import { RetryLink } from "@apollo/client/link/retry";
131+
*
132+
* const link = new RetryLink();
133+
* ```
134+
*/
107135
export class RetryLink extends ApolloLink {
108136
private delayFor: DelayFunction;
109137
private retryIf: RetryFunction;

0 commit comments

Comments
 (0)