Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for _handled #2806

Closed
MartinMalinda opened this issue Dec 12, 2020 · 2 comments
Closed

Support for _handled #2806

MartinMalinda opened this issue Dec 12, 2020 · 2 comments

Comments

@MartinMalinda
Copy link

MartinMalinda commented Dec 12, 2020

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() 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.

Thanks for any input!
(relevant issue in vue-concurrency: MartinMalinda/vue-concurrency#25)

What does the proposed API look like?

somePromiseLikeObject._handled = true;

@posva
Copy link
Member

posva commented Dec 12, 2020

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

@posva posva closed this as completed Dec 12, 2020
@MartinMalinda
Copy link
Author

"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.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants