refactor(ssr): improve ssr async setup / suspense error handling

This commit is contained in:
Evan You
2020-03-10 15:28:13 -04:00
parent 9c4de7b9ed
commit 47ead3b33a
3 changed files with 58 additions and 20 deletions

View File

@@ -337,7 +337,7 @@ function setupStatefulComponent(
// 2. create props proxy
// the propsProxy is a reactive AND readonly proxy to the actual props.
// it will be updated in resolveProps() on updates before render
const propsProxy = (instance.propsProxy = isInSSRComponentSetup
const propsProxy = (instance.propsProxy = isSSR
? instance.props
: shallowReadonly(instance.props))
// 3. call setup()
@@ -360,7 +360,7 @@ function setupStatefulComponent(
currentSuspense = null
if (isPromise(setupResult)) {
if (isInSSRComponentSetup) {
if (isSSR) {
// return the promise so server-renderer can wait on it
return setupResult.then(resolvedResult => {
handleSetupResult(instance, resolvedResult, parentSuspense, isSSR)