Skip to content

Commit

Permalink
chore: improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 committed Jan 1, 2024
1 parent 6522fee commit 1f9df90
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/server-renderer/__tests__/ssrSlot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ describe('ssr: slot', () => {
createApp({
components: {
one: {
template: `<transition><slot/></transition>`,
template: `<TransitionGroup tag="div"><slot/></TransitionGroup>`,
},
},
template: `<one><p v-for="i in 2">{{i}}</p></one>`,
}),
),
).toBe(`<p>1</p><p>2</p>`)
).toBe(`<div><p>1</p><p>2</p></div>`)
})
})
2 changes: 1 addition & 1 deletion packages/server-renderer/src/helpers/ssrRenderSlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ 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 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.
const buffer = slotBuffer[i]
if (transition && (buffer === '<!--[-->' || buffer === '<!--]-->')) {
continue
}
Expand Down

0 comments on commit 1f9df90

Please sign in to comment.