Skip to content

feat(make-cancelable): add support for cancelling promises using AbortController #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 4, 2025

Conversation

JoaoTMDias
Copy link
Collaborator

Summary

Because:

  • The makeCancelable function needed improvements in type safety, error handling, and memory management
  • The documentation was outdated and missing important usage examples
  • The tests needed better coverage and reliability

This Commit:

  • Adds proper TypeScript type safety with AbortPromiseError class
  • Adds isCancelled method to check cancellation state
  • Improves memory management with proper event listener cleanup
  • Makes cancel method safe to call multiple times
  • Improves error handling with proper error types and messages
  • Updates documentation with comprehensive API docs and examples
  • Adds React-specific example showing cleanup in useEffect
  • Improves test coverage and reliability

Is this a Breaking Change?

  • No

@JoaoTMDias JoaoTMDias self-assigned this Jun 4, 2025
Copy link
Contributor

github-actions bot commented Jun 4, 2025

size-limit report 📦

Path Size
dist/index.cjs 7.48 KB (+1.81% 🔺)
dist/index.mjs 4.82 KB (+2.3% 🔺)
dist/hooks.cjs 4.28 KB (0%)
dist/hooks.mjs 3.22 KB (0%)

@JoaoTMDias JoaoTMDias merged commit fff898a into main Jun 4, 2025
9 checks passed
@JoaoTMDias JoaoTMDias deleted the feat-jd-make-cancelable-add-abort-controller branch June 4, 2025 18:12
github-actions bot pushed a commit that referenced this pull request Jun 4, 2025
# [2.2.0](v2.1.0...v2.2.0) (2025-06-04)

### Features

* **make-cancelable:** add support for cancelling promises using AbortController ([#4](#4)) ([fff898a](fff898a))
Copy link
Contributor

github-actions bot commented Jun 4, 2025

🎉 This PR is included in version 2.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants