feat(client): timeout link plugin#1697
Conversation
Add TimeoutLinkPlugin that aborts requests exceeding a static or per-request dynamic timeout with an AbortError, plus an anyAbortSignal helper in @orpc/shared that prefers the built-in AbortSignal.any.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
More templates
@orpc/arktype
@orpc/bun
@orpc/client
@orpc/cloudflare
@orpc/contract
@orpc/experimental-effect
@orpc/evlog
@orpc/json-schema
@orpc/nest
@orpc/next
@orpc/openapi
@orpc/opentelemetry
@orpc/pinia-colada
@orpc/pino
@orpc/publisher
@orpc/ratelimit
@orpc/server
@orpc/shared
@orpc/tanstack-query
@orpc/trpc
@orpc/valibot
@orpc/zod
commit: |
There was a problem hiding this comment.
ℹ️ No critical issues — two minor wording notes inline.
Reviewed changes — a new client TimeoutLinkPlugin that aborts requests after a configured timeout, plus a shared anyAbortSignal helper that merges the caller-provided signal with a plugin-managed timeout signal.
- Added
TimeoutLinkPluginwith static or per-requesttimeout, disabled bynull/undefined - Added
anyAbortSignalhelper that prefersAbortSignal.anyand falls back to a manual event-listener implementation - Added tests for the plugin and both signal code paths, plus a VitePress docs page and nav entry
Kimi K2 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ New commit review — the export snapshot addition is the only change, and it looks correct.
Reviewed changes since 7104711 — commit 19cac766 adds TimeoutLinkPlugin to the packages/client/src/plugins/index.test.ts export snapshot, matching the new export * from './timeout' and keeping the public-surface assertion complete.
No new issues introduced by this commit.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |

Summary
Adds
TimeoutLinkPlugin, which automatically aborts requests that exceed a given timeout with anAbortError. The timeout can be static or resolved per request, and returningnull/undefineddisables it (e.g. for long-lived requests).Changes
TimeoutLinkPluginin@orpc/client/plugins, works with any linkanyAbortSignalhelper in@orpc/shared, preferring the built-inAbortSignal.anywhen available/docs/plugins/timeout