]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix: ssr buildSlots not use cache
authordaiwei <daiwei521@126.com>
Thu, 23 Jan 2025 07:09:08 +0000 (15:09 +0800)
committerdaiwei <daiwei521@126.com>
Thu, 23 Jan 2025 07:09:08 +0000 (15:09 +0800)
packages/compiler-core/src/transforms/vSlot.ts
packages/compiler-ssr/src/transforms/ssrTransformComponent.ts

index b238247b9f4f111739226e0b493930f188fda3cf..4c90dff122012574dffb2da5c2a860f4b596bbdf 100644 (file)
@@ -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,
index cad1ee8102897beab4c8990b99b43366c5d42655..4ba3e1c8d16ebc8854e3e3643a8d59c1918fd977 100644 (file)
@@ -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') {