refactor: simplify suspense ssr + adjust behavior
This commit is contained in:
@@ -9,12 +9,12 @@ describe('ssr compile: suspense', () => {
|
||||
return function ssrRender(_ctx, _push, _parent) {
|
||||
const _component_foo = _resolveComponent(\\"foo\\")
|
||||
|
||||
_push(_ssrRenderSuspense({
|
||||
default: (_push) => {
|
||||
_ssrRenderSuspense(_push, {
|
||||
default: () => {
|
||||
_push(_ssrRenderComponent(_component_foo, null, null, _parent))
|
||||
},
|
||||
_: 1
|
||||
}))
|
||||
})
|
||||
}"
|
||||
`)
|
||||
})
|
||||
@@ -36,15 +36,15 @@ describe('ssr compile: suspense', () => {
|
||||
return function ssrRender(_ctx, _push, _parent) {
|
||||
const _component_foo = _resolveComponent(\\"foo\\")
|
||||
|
||||
_push(_ssrRenderSuspense({
|
||||
default: (_push) => {
|
||||
_ssrRenderSuspense(_push, {
|
||||
default: () => {
|
||||
_push(_ssrRenderComponent(_component_foo, null, null, _parent))
|
||||
},
|
||||
fallback: (_push) => {
|
||||
fallback: () => {
|
||||
_push(\` loading... \`)
|
||||
},
|
||||
_: 1
|
||||
}))
|
||||
})
|
||||
}"
|
||||
`)
|
||||
})
|
||||
|
||||
@@ -38,7 +38,7 @@ export function ssrTransformSuspense(
|
||||
wipMap.set(node, wipEntry)
|
||||
wipEntry.slotsExp = buildSlots(node, context, (_props, children, loc) => {
|
||||
const fn = createFunctionExpression(
|
||||
[`_push`],
|
||||
[],
|
||||
undefined, // no return, assign body later
|
||||
true, // newline
|
||||
false, // suspense slots are not treated as normal slots
|
||||
@@ -71,8 +71,9 @@ export function ssrProcessSuspense(
|
||||
}
|
||||
// _push(ssrRenderSuspense(slots))
|
||||
context.pushStatement(
|
||||
createCallExpression(`_push`, [
|
||||
createCallExpression(context.helper(SSR_RENDER_SUSPENSE), [slotsExp])
|
||||
createCallExpression(context.helper(SSR_RENDER_SUSPENSE), [
|
||||
`_push`,
|
||||
slotsExp
|
||||
])
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user