Which cancellation strategy for fetch timeouts is most reliable across browsers and Node?
0 reputation · 26 Nov 2022, 03:31 UTC
Goal
Determine a consistent way to cancel fetch requests with a timeout while avoiding double-abort events and AbortController retention across browsers and Node.js.
Constraints
Target modern browsers and Node.js ≥16. Prefer native AbortSignal over library tokens. Avoid retaining controllers for long-lived requests. Avoid ambiguous error handling when manual abort and timeout can fire.
Open questions
Does AbortSignal.timeout propagate reliably to fetch in all supported environments? Can combining a manual AbortController with an AbortSignal.timeout produce duplicate abort notifications, and what observable behavior results? Which composition pattern minimizes controller retention when requests are aborted or time out?