Retry
The retry option auto-retries on timeout and business failures; manual abort (abort() or external abortSignal) does not retry.
typescript
const loader = new AsyncLoader(
(args) => fetch("/api/data", { signal: args.abortSignal }),
{
timeout: 5_000, // 5 seconds per attempt
retry: 3, // up to 3 retries (4 attempts total)
retryDelay: 1_000, // wait 1 second before each retry
}
);Retry rules
| Failure type | Retries? |
|---|---|
| Business error (loader throws / rejects) | ✅ Yes |
Timeout (triggered by timeout) | ✅ Yes |
Manual abort() | ❌ No |
External abortSignal abort | ❌ No |
Related options
| Option | Default | Description |
|---|---|---|
retry | 0 | Max retry count (retry: 3 means up to 4 attempts total) |
retryDelay | 0 | Milliseconds to wait before each retry |
timeout | — | Per-attempt loading timeout; a timeout counts as a retryable failure |
Abort terminates retry wait
When you call abort() during a retry wait, the wait is terminated as well.