andrewcourtice / harlem

Powerfully simple global state management for Vue 3
https://harlemjs.com
MIT License
516 stars 16 forks source link

Fix task abort resolution #55

Closed andrewcourtice closed 2 years ago

andrewcourtice commented 2 years ago

This fixes an issue with the Task where subsequent onAbort handlers are interrupted if a preceding handler finalises the underlying promise. This could lead to memory leaks if cleanup tasks are being handled in the onAbort callback after the task resolution.

Calling resolve/reject inside the onAbort handler now defers the resolution until all onAbort handlers have been called. The Task only accepts the outcome of the first handler to call resolve/reject - subsequent calls to resolve/reject will have no affect on the Task outcome.

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/andrewcourtice/harlem/DcY3TBHMALVQZaSeoLGx57gVircW
✅ Preview: https://harlem-git-fix-task-abort-resolution-andrewcourtice.vercel.app