Cancellation In JavaScript: Why It's Harder Than It Looks
At some point, every JavaScript developer asks the same question: why can't I just cancel this async operation? A user navigates away, a component unmounts, a newer request supersedes an older one - surely there must be a way to stop work that's no longer needed! In practice, we reach for familiar patterns: Promise.race() with a timeout, ignoring the result when it eventually arrives, or wiring up an AbortController and assuming the problem is solved. Often this appears to work, until the application starts leaking resources, performing late side effects, or behaving inconsistently under load.