Skip to content

Commit

Permalink
chore: pass undefined to slotScopeId
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 committed Dec 10, 2024
1 parent 21454ce commit 4d7a697
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
42 changes: 21 additions & 21 deletions packages/compiler-ssr/__tests__/ssrVShow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ describe('ssr: v-show', () => {
expect(
compileWithWrapper(`<Foo :style="{color:'red'}" v-show="foo"/>`).code,
).toMatchInlineSnapshot(`
"const { resolveComponent: _resolveComponent } = require("vue")
const { ssrRenderComponent: _ssrRenderComponent, ssrRenderAttrs: _ssrRenderAttrs } = require("vue/server-renderer")
"const { resolveComponent: _resolveComponent } = require("vue")
const { ssrRenderComponent: _ssrRenderComponent, ssrRenderAttrs: _ssrRenderAttrs } = require("vue/server-renderer")
return function ssrRender(_ctx, _push, _parent, _attrs) {
const _component_Foo = _resolveComponent("Foo")
return function ssrRender(_ctx, _push, _parent, _attrs) {
const _component_Foo = _resolveComponent("Foo")
_push(\`<div\${_ssrRenderAttrs(_attrs)}>\`)
_push(_ssrRenderComponent(_component_Foo, { style: {color:'red'} }, null, _parent, '', {
style: (_ctx.foo) ? null : { display: "none" }
}))
_push(\`</div>\`)
}"
`)
_push(\`<div\${_ssrRenderAttrs(_attrs)}>\`)
_push(_ssrRenderComponent(_component_Foo, { style: {color:'red'} }, null, _parent, undefined, {
style: (_ctx.foo) ? null : { display: "none" }
}))
_push(\`</div>\`)
}"
`)
})

test('with dynamic component', () => {
Expand All @@ -58,17 +58,17 @@ describe('ssr: v-show', () => {
`<component is="Foo" :style="{color:'red'}" v-show="foo"/>`,
).code,
).toMatchInlineSnapshot(`
"const { resolveDynamicComponent: _resolveDynamicComponent, createVNode: _createVNode } = require("vue")
const { ssrRenderVNode: _ssrRenderVNode, ssrRenderAttrs: _ssrRenderAttrs } = require("vue/server-renderer")
"const { resolveDynamicComponent: _resolveDynamicComponent, createVNode: _createVNode } = require("vue")
const { ssrRenderVNode: _ssrRenderVNode, ssrRenderAttrs: _ssrRenderAttrs } = require("vue/server-renderer")
return function ssrRender(_ctx, _push, _parent, _attrs) {
_push(\`<div\${_ssrRenderAttrs(_attrs)}>\`)
_ssrRenderVNode(_push, _createVNode(_resolveDynamicComponent("Foo"), { style: {color:'red'} }, null), _parent, '', {
style: (_ctx.foo) ? null : { display: "none" }
})
_push(\`</div>\`)
}"
`)
return function ssrRender(_ctx, _push, _parent, _attrs) {
_push(\`<div\${_ssrRenderAttrs(_attrs)}>\`)
_ssrRenderVNode(_push, _createVNode(_resolveDynamicComponent("Foo"), { style: {color:'red'} }, null), _parent, undefined, {
style: (_ctx.foo) ? null : { display: "none" }
})
_push(\`</div>\`)
}"
`)
})

test('with static style', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/compiler-ssr/src/transforms/ssrTransformComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export const ssrTransformComponent: NodeTransform = (node, context) => {
]),
`_parent`,
]
if (vShowExp) args.push(`''`, vShowExp)
if (vShowExp) args.push(`undefined`, vShowExp)
node.ssrCodegenNode = createCallExpression(
context.helper(SSR_RENDER_VNODE),
args,
Expand All @@ -213,7 +213,7 @@ export const ssrTransformComponent: NodeTransform = (node, context) => {
slots,
`_parent`,
]
if (vShowExp) args.push(`''`, vShowExp)
if (vShowExp) args.push(`undefined`, vShowExp)
node.ssrCodegenNode = createCallExpression(
context.helper(SSR_RENDER_COMPONENT),
args,
Expand Down

0 comments on commit 4d7a697

Please sign in to comment.