MartinMalinda / vue-concurrency

A library for encapsulating asynchronous operations and managing concurrency for Vue and Composition API.
https://vue-concurrency.netlify.app/
MIT License
350 stars 15 forks source link

Unhandled rejection / error in Vue 3 #25

Open MartinMalinda opened 3 years ago

MartinMalinda commented 3 years ago

Vue 3 seems to be even more careful about unhandled rejections than Vue 2. Due to the nature of the tasks, where you sometimes you do things like

await task.perform();
if (!task.isError) {

}

This can be annoying.

Or maybe even when the perform function is passed directly in the template:

@submit="saveTask.perform"

It seems like Vue 3 is checking if the result is thenable and then check if the promise rejection is handled. But this internal Vue code makes the task think it's being "awaited" and it makes the task to throw. It's a catch 22.

[Vue warn]: Unhandled error during execution of component event handler ...

There was a way to prevent this in Vue 2, I'll see if if it's possible in Vue 3 too.