Skip to content

Commit

Permalink
fix: ssr buildSlots not use cache
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 committed Jan 23, 2025
1 parent 4974e5d commit 84a733e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/compiler-core/src/transforms/vSlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,13 @@ export function buildSlots(
node: ComponentNode,
context: TransformContext,
buildSlotFn: SlotFnBuilder = buildClientSlotFn,
useCache: boolean = true,
): {
slots: SlotsExpression
hasDynamicSlots: boolean
} {
// return early if slots are already built to avoid duplication
if (node.slots) {
// early return if slots are already built to avoid duplication
if (useCache && node.slots) {
return {
slots: node.slots,
hasDynamicSlots: node.hasDynamicSlots,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export const ssrTransformComponent: NodeTransform = (node, context) => {
}

const slots = node.children.length
? buildSlots(node, context, buildSSRSlotFn).slots
? buildSlots(node, context, buildSSRSlotFn, false).slots
: `null`

if (typeof component !== 'string') {
Expand Down

0 comments on commit 84a733e

Please sign in to comment.