From: daiwei Date: Thu, 23 Jan 2025 07:09:08 +0000 (+0800) Subject: fix: ssr buildSlots not use cache X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84a733ebccc7b1566f31f0c5eb1ab32256030080;p=thirdparty%2Fvuejs%2Fcore.git fix: ssr buildSlots not use cache --- diff --git a/packages/compiler-core/src/transforms/vSlot.ts b/packages/compiler-core/src/transforms/vSlot.ts index b238247b9f..4c90dff122 100644 --- a/packages/compiler-core/src/transforms/vSlot.ts +++ b/packages/compiler-core/src/transforms/vSlot.ts @@ -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, diff --git a/packages/compiler-ssr/src/transforms/ssrTransformComponent.ts b/packages/compiler-ssr/src/transforms/ssrTransformComponent.ts index cad1ee8102..4ba3e1c8d1 100644 --- a/packages/compiler-ssr/src/transforms/ssrTransformComponent.ts +++ b/packages/compiler-ssr/src/transforms/ssrTransformComponent.ts @@ -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') {