Subscribe on changes!

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

avatar
Nov 13th 2020

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.

avatar
Nov 13th 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

avatar
Nov 13th 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.

avatar
May 24th 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?

avatar
Sep 9th 2021

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

avatar
May 30th 2022

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