Skip to content

feat: add abort controller hook, toast tests, type exports, and date utils#216

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
devwums:feat/abort-tests-types-dates
Apr 26, 2026
Merged

feat: add abort controller hook, toast tests, type exports, and date utils#216
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
devwums:feat/abort-tests-types-dates

Conversation

@devwums
Copy link
Copy Markdown
Contributor

@devwums devwums commented Apr 26, 2026

Summary

This PR addresses four issues across reliability, testing, types, and internationalization:

  • Request Cancellation: Added useAbortController hook in src/hooks/useAbortController.ts - returns a stable getSignal() function that aborts the previous in-flight request each time it is called and cleans up automatically on component unmount, preventing memory leaks and stale state updates
  • Component Integration Tests: Added src/components/ui/tests/Toast.test.tsx with integration tests covering rendering by type (info/success/error), message display, and close button interaction
  • Public Type Exports: Added src/types/index.ts as a barrel that re-exports all public types from �pi.ts and �nalytics.ts - consumers can now import from @/types instead of individual files
  • Date/Time Localization: Added src/utils/dateUtils.ts with ormatDate, ormatShortDate, ormatTime, and ormatRelative - all built on Intl.DateTimeFormat and Intl.RelativeTimeFormat so they automatically respect the user's locale and timezone

Changes

  • src/hooks/useAbortController.ts - abort controller hook with auto-cleanup on unmount
  • src/components/ui/tests/Toast.test.tsx - Toast component integration tests
  • src/types/index.ts - public type barrel export
  • src/utils/dateUtils.ts - locale-aware date and time formatting utilities

closes #175
closes #176
closes #180
closes #181

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 26, 2026

@devwums Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

…utils

- Add useAbortController hook to cancel in-flight requests on unmount (closes rinafcode#175)
- Add Toast component integration tests (closes rinafcode#176)
- Add src/types/index.ts as public type barrel export (closes rinafcode#180)
- Add locale-aware date formatting utilities using Intl.DateTimeFormat (closes rinafcode#181)
@RUKAYAT-CODER RUKAYAT-CODER merged commit cd16038 into rinafcode:main Apr 26, 2026
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Date/Time Localization Missing Type Exports Component Integration Tests Missing Request Cancellation

2 participants