Axios CancelToken Deprecation and AbortController Signal Merging Compatibility in Version 1.x
0 reputation · 29 Jan 2025, 11:17 UTC
Assess the implications of Axios 1.x dual‑support for CancelToken and AbortController when deciding whether to retain the legacy CancelToken API in new code.
The library now normalizes both config.cancelToken and config.signal into a single AbortSignal, and the CancelToken factory remains functional but is marked as deprecated with no published removal timeline. This creates uncertainty about future deprecation warnings, possible build failures when warnings are treated as errors, and the risk of unexpected abort behavior if developers assume exclusive control over cancellation.
What are the practical risks of continuing to use CancelToken alongside AbortController signals? Should teams migrate exclusively to AbortController now, or is it safe to maintain dual usage until a firm deprecation date is announced? How might the merged abort listener affect error handling and testability in applications that rely on precise cancellation timing?