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

Lack of <Suspense> wrapping an async setup component should warn #2603

Closed
altinselimi opened this issue Nov 13, 2020 · 5 comments
Closed

Lack of <Suspense> wrapping an async setup component should warn #2603

altinselimi opened this issue Nov 13, 2020 · 5 comments
Labels
🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. scope: suspense ✨ feature request New feature or request

Comments

@altinselimi
Copy link

Version

3.0.2

Reproduction link

https://codesandbox.io/s/competent-darwin-lv4zh?file=/src/use/usePropsLoaded.js

Steps to reproduce

Open the codesandbox link and wait 2 seconds.
The usePropsLoaded hook returns a promise which resolves when all props of said component are filled.
Or thats what it tries to do.
Neither #fallback or #default renders at all.

What is expected?

#fallback (at least) to render

What is actually happening?

An warning is thrown on the console:
Unhandled error during execution of scheduler flush. This is likely a Vue internals bug.

@posva
Copy link
Member

posva commented Nov 13, 2020

You have to use Suspense on the parent (App.vue) of hello world.
There use to be a warning for that, It's weird it's gone

@posva posva changed the title Unhandled error during execution of scheduler flush. Lack of <Suspense> wrapping an async setup component should warn Nov 13, 2020
@jods4
Copy link
Contributor

jods4 commented Nov 13, 2020

While adding Suspense warnings, for as long that #2215 isn't fixed is it possible to also add a warning when a Suspense catches a nested async setup but doesn't recede to pending. I mentioned it in the comments of that other issue, the code that needs a warning is here:

https://github.com/vuejs/vue-next/blob/0227b4a697afd598f6fa279a1a7ce84242e68f43/packages/runtime-core/src/components/Suspense.ts#L545-L546

Currently your async setup component just doesn't show up. Blank screen, no warning on console, no error in JS.

@tvkit
Copy link

tvkit commented May 24, 2021

You have to use Suspense on the parent (App.vue) of hello world.

@posva what about detecting that a Promise was returned, and then await automatically? What's the downside to that?

@posva posva added ✨ feature request New feature or request 🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. labels Jun 16, 2021
@cexbrayat
Copy link
Member

It used to warn but was removed (in this commit https://github.com/vuejs/vue-next/pull/2099/files#diff-56930a63772d2e89f19432918b9d6ed851ede4159b0d32404e0c1d8c159fec99L1241)

PR #3657 should fix it when merged

@homersimpsons
Copy link

This now seems fixed. In fact the warning appears correctly, the fallback won't appear as it is not at the right place.

@posva posva closed this as completed May 31, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Sep 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. scope: suspense ✨ feature request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants