AbortController
Slap yourself if
You think AbortController just cancels fetch and nothing else needs to care.
Why this exists
AbortController exists because async work outlives user intent. Without a standard cancellation signal, abandoned requests, effects, and streams keep running, wasting resources and corrupting state long after the UI moved on.
Mental model
AbortController is not a cancel button — it’s a shared cancellation signal. Anything that doesn’t explicitly listen to it will happily keep going.
- An AbortController creates an AbortSignal.
- The signal is passed into async APIs that opt into cancellation.
- Calling abort() synchronously flips the signal state.
- Listeners are notified; cooperative tasks stop themselves.
- Non-cooperative tasks continue unaffected.
- Assuming abort forcibly stops execution.
- Cancelling fetch but not downstream processing.
- Reusing controllers across unrelated lifecycles.
- Treating abort as an error instead of a control signal.
AbortController provides a standardized cancellation signal for async operations, allowing cooperative APIs to stop work when user intent or lifecycle changes invalidate it.
- Async code without cancellation paths
- Cleanup relying on component unmount only
- Abort treated as exceptional failure
- Controllers shared globally or reused incorrectly
Deep dive
Requires Pro
Premium deep dives include more internals, more scars.