Closes #1050
Implemented an AbortController in the useSubscription hook to correctly cancel in-flight getEvents requests when the component unmounts. This prevents the React "can't perform a state update on an unmounted component" warnings and ensures no stale onEvent callbacks execute post-unmount.
src/hooks/useSubscription.ts:- Initialized an
AbortControlleralongside thestopflag. - Passed the
controller.signalto a wrapper promise aroundserver.getEventsso that if the component unmounts, the request immediately rejects with anAbortError. - Added early returns (
if (stop || controller.signal.aborted) return;) before processing events to ensure no callbacks are triggered on an unmounted component. - Added
controller.abort()in theuseEffectcleanup return block. - Updated the
catchblock to cleanly suppress expectedAbortErrors instead of logging them as unexpected failures.
- Initialized an
- Ran
npm run build:fastto confirm there are no TypeScript compilation errors. - Ran
npm run lintto verify adherence to@typescript-eslint/prefer-promise-reject-errorsand@typescript-eslint/no-explicit-any. - Verified the cleanup correctly aborts and suppresses logs.