Subscribe on changes!

Add warn or error when using async setup() outside <Suspense/>

avatar
Mar 15th 2021

What problem does this feature solve?

Currently when using async setup() on a component that is not wrapped in results in not rendering the component. This is expected behaviour but not having a warn or an error creates a poor development experience. So by adding at least a warn it will make sure the people won't look at a blank screen not knowing what they did wrong ( like I did )

What does the proposed API look like?

Whenever you leave

async setup () {}

a warn to be thrown in the console.

Example:

[Vue warn]: Components using async setup() should be wrapped in Suspense in order to render

And maybe a tip/reminder that a separate function can be used.

Example:

[Vue warn]: Components using async setup() should be wrapped in Suspense in order to render. Consider using separate function to use await in.