wip: suspense feature flag

This commit is contained in:
Evan You
2019-09-09 16:28:32 -04:00
parent 7e70acf9c2
commit d5e9682040
5 changed files with 37 additions and 16 deletions

View File

@@ -242,9 +242,16 @@ export function setupStatefulComponent(instance: ComponentInternalInstance) {
isFunction(setupResult.then) &&
isFunction(setupResult.catch)
) {
// async setup returned Promise.
// bail here and wait for re-entry.
instance.asyncDep = setupResult as Promise<any>
if (__FEATURE_SUSPENSE__) {
// async setup returned Promise.
// bail here and wait for re-entry.
instance.asyncDep = setupResult as Promise<any>
} else if (__DEV__) {
warn(
`setup() returned a Promise, but the version of Vue you are using ` +
`does not support it yet.`
)
}
return
} else {
handleSetupResult(instance, setupResult)