You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Vue 2, it was possible to attach _handled on a Promise or especially PromiseLike object to let Vue know it's been handled, maybe in a different way.
It seems like this is not yet possible in Vue 3.
My usecase:
I quite need this in vue-concurrency: https://github.com/MartinMalinda/vue-concurrency/blob/master/src/TaskInstance.ts#L52. TaskInstance is a PromiseLike object and by design it's kind of always handled. The thrown error is saved on the object itself and it can be then rendered in the template and so on. vue-concurrency detects if tasks is being used as a promise and starts throwing in that case so that then() and catch() works. This does not go well together with vue templates which seem to automatically attach then and catch on promises. That makes it seem like these TaskInstances are always unhandled. _handled = true prevented that nicely in Vue 2.
If you want to open a bug report please provide a boiled down repro of what you are trying to do but it looks like you were relying on internals.
It's not clear what you mean by let Vue know it's been handled
"let Vue know it's been handled" means "don't report the unhandled promise rejection / error". Sorry if it wasn't clear.
For example:
"[Vue warn]: Unhandled error during execution of mounted hook ..."
I could open a bug report if it was a bug. But as you said, I did rely on internals and I'm looking for a way to achieve the same thing in Vue 3, so it's probably not a bug.
I'll try to look for other approaches to solve this problem then.
What problem does this feature solve?
Hi!
In Vue 2, it was possible to attach
_handled
on a Promise or especially PromiseLike object to let Vue know it's been handled, maybe in a different way.It seems like this is not yet possible in Vue 3.
My usecase:
I quite need this in vue-concurrency: https://github.com/MartinMalinda/vue-concurrency/blob/master/src/TaskInstance.ts#L52. TaskInstance is a PromiseLike object and by design it's kind of always handled. The thrown error is saved on the object itself and it can be then rendered in the template and so on. vue-concurrency detects if tasks is being used as a promise and starts throwing in that case so that
then()
andcatch()
works. This does not go well together with vue templates which seem to automatically attachthen
andcatch
on promises. That makes it seem like these TaskInstances are always unhandled._handled = true
prevented that nicely in Vue 2.Thanks for any input!
(relevant issue in vue-concurrency: MartinMalinda/vue-concurrency#25)
What does the proposed API look like?
somePromiseLikeObject._handled = true;
The text was updated successfully, but these errors were encountered: