|
@@ -654,7 +654,6 @@ function setupStatefulComponent(
|
|
|
|
|
|
|
|
if (isPromise(setupResult)) {
|
|
if (isPromise(setupResult)) {
|
|
|
setupResult.then(unsetCurrentInstance, unsetCurrentInstance)
|
|
setupResult.then(unsetCurrentInstance, unsetCurrentInstance)
|
|
|
-
|
|
|
|
|
if (isSSR) {
|
|
if (isSSR) {
|
|
|
// return the promise so server-renderer can wait on it
|
|
// return the promise so server-renderer can wait on it
|
|
|
return setupResult
|
|
return setupResult
|
|
@@ -668,6 +667,15 @@ function setupStatefulComponent(
|
|
|
// async setup returned Promise.
|
|
// async setup returned Promise.
|
|
|
// bail here and wait for re-entry.
|
|
// bail here and wait for re-entry.
|
|
|
instance.asyncDep = setupResult
|
|
instance.asyncDep = setupResult
|
|
|
|
|
+ if (__DEV__ && !instance.suspense) {
|
|
|
|
|
+ const name = Component.name ?? 'Anonymous'
|
|
|
|
|
+ warn(
|
|
|
|
|
+ `Component <${name}>: setup function returned a promise, but no ` +
|
|
|
|
|
+ `<Suspense> boundary was found in the parent component tree. ` +
|
|
|
|
|
+ `A component with async setup() must be nested in a <Suspense> ` +
|
|
|
|
|
+ `in order to be rendered.`
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
} else if (__DEV__) {
|
|
} else if (__DEV__) {
|
|
|
warn(
|
|
warn(
|
|
|
`setup() returned a Promise, but the version of Vue you are using ` +
|
|
`setup() returned a Promise, but the version of Vue you are using ` +
|