diff --git a/packages/server-renderer/__tests__/ssrSlot.spec.ts b/packages/server-renderer/__tests__/ssrSlot.spec.ts index 9060e6054db..7e2b2247d25 100644 --- a/packages/server-renderer/__tests__/ssrSlot.spec.ts +++ b/packages/server-renderer/__tests__/ssrSlot.spec.ts @@ -145,12 +145,12 @@ describe('ssr: slot', () => { createApp({ components: { one: { - template: ``, + template: ``, }, }, template: `

{{i}}

`, }), ), - ).toBe(`

1

2

`) + ).toBe(`

1

2

`) }) }) diff --git a/packages/server-renderer/src/helpers/ssrRenderSlot.ts b/packages/server-renderer/src/helpers/ssrRenderSlot.ts index 501bb794b09..6ac66f680c9 100644 --- a/packages/server-renderer/src/helpers/ssrRenderSlot.ts +++ b/packages/server-renderer/src/helpers/ssrRenderSlot.ts @@ -83,18 +83,16 @@ export function ssrRenderSlotInner( } } else { for (let i = 0; i < slotBuffer.length; i++) { + const buffer = slotBuffer[i] // #9933 // Although we handle Transition/TransitionGroup in the transform stage - // without rendering them as fragments, the content passed into the slot + // without rendering it as a fragment, the content passed into the slot // may still be a fragment. // Therefore, here we need to avoid rendering it as a fragment again. - if ( - transition && - (slotBuffer[i] === '' || slotBuffer[i] === '') - ) { + if (transition && (buffer === '' || buffer === '')) { continue } - push(slotBuffer[i]) + push(buffer) } } }