Backtestsvuerun-20261005-124535#15048

Issue #15048 Merged fix PR #15051 Run 5 Oct 2026 · run-20261005-124535 vuejs/core

Scoped slot transforms array argument if rendered conditionally

Better

Our patch was judged better than the merged fix.

In this judgment, Patch B = our agent, Patch A = the merged fix.

Both patches fix the core issue the same way: when a key is injected into a slot outlet, it goes to a new trailing `renderSlot` argument instead of being merged into the slot props, so a `v-bind` array reaches the slot unchanged.

**Patch B** is more precise and more thorough.
- It only takes the separate-key path when the props are a single `v-bind` expression, which is the case that actually breaks. Plain-object props keep their existing behavior, so existing snapshots are unchanged.
- It also fixes a closely related path the same root cause reaches: the `ref_for` marker merged by `v-for` with `v-bind` on a slot outlet, which also turns arrays into objects. It does this by skipping `pushRefVForMarker` for slot outlets.
- In custom element mode, it puts the key on the wrapping Fragment.
- Its tests are strong:
  - compiler-level tests for `v-if` and keyed `v-for`;
  - a negative test confirming `mergeProps` is kept when other props exist;
  - an end-to-end compiler+runtime integration test that checks `Array.isArray` on the slot props across `v-if`/`v-else`, keyed and unkeyed template `v-for`, and `v-for` on `<slot>`, including toggling;
  - an SSR hydration test.
- These would clearly fail before the change.

**Patch A** is broader and riskier.
- It routes every injected slot key through the new argument, even for plain object props. That changes generated output for all `v-if` slots, changes the props slots receive (`key` disappears), and rewrites existing snapshot expectations.
- It leaves the `v-for` `ref_for` merging path unaddressed, so `<slot v-for v-bind="arr">` still converts the array.
- Its snapshot changes look suspect. A `v-for` snapshot entry was added to `transformElement.spec.ts.snap`, and the diff shows identical blob hashes for that file and `vFor.spec.ts.snap`. That suggests accidental snapshot churn.
- Its tests are mostly compiler-shape and `renderSlot` unit tests. There is no end-to-end check that the slot receives an array.

Overall, B fixes the root cause more completely, with less churn and stronger behavioral tests.

The judge saw only the two patches, labelled A and B in random order, with issue links and version numbers removed. The reasoning above is shown verbatim.

Solve

19m 35s

Wall-clock time in the container

Full test suite

No new failures

3,626 passed · 6 skipped · 3,633 total

Contamination audit

Clean

No sign the agent saw the real fix

Patch size

188vs 266 merged

Changed lines, ours vs merged

Vue version

3.5.0

Link to minimal reproduction

https://play.vuejs.org/#eNqFUk1v00AQ/SvDXgxSYqsEDgSnEqBKwAEQReLAoiq1J+m2+6XdtZvK8n/v7Dp2oyptb7Pz3s68mTcd+2Rt3jbIlqz0lRM2gMfQ2FOuhbLGBejA4QZ62DijICNqNkFfjLL7fF7ER6yUfeSa68poH0D5Lazi/9fZV5TSwF/jZP0qe8N1WQztqBE9Aior1wHpBVCmuu3cSxNWnAkCPWcJAug6SAno+8RNfQkri4MabMaCJwkbsc2vvdE0XRfZnFXEFhLdTxsESeRsCQmJ2JoU3n5PueAanI356gqrmyP5a7+LOc5+OfToWuRswsLabTEM8Nn5D9xRPIHK1I0k9jPgb/RGNlHjQPvc6JpkH/CS2m/JCKG3f/zZLqD241BRaGT2ic8ZGRMX9dToD3IX+bv0j+uetjiaeuQ8BocHL1bwL4vRSTaDFLwdg0X2n+7hObNr0e6tLb1d69Nzcp1ORtfosAZtnKJJ76hCBMtLB8VEj8x2fil0/XAme7gsxrqxAfhwJ5FIiuYUeh6MXcKJQzWd1bHeNGEt4q5eECA2B+1f0PP4TC9adNE0WvAif58vPrD+HmmCLos=

Steps to reproduce

  1. Create a component with a scoped slot that is rendered conditionally
  2. Pass an array as the sole argument to the slot

What is expected?

Array is rendered normally.
If you render items of that array in v-for loop, you only see items inside that array

What is actually happening?

Array is transformed into object. Items and their indexes are staying the same, key field is added

<img width="383" height="111" alt="Image" src="https://github.com/user-attachments/assets/338bc873-5c20-4fb3-aed9-88f9f8e8cd98" />

System Info

Any additional comments?

key attribute is generated by the compiler for the slot rendered with v-if.

<img width="781" height="243" alt="Image" src="https://github.com/user-attachments/assets/99704cf9-71cb-435d-ba6f-92578b65ff5d" />

While this is not explicitly mentioned in documentation, one can assume that the expectation is that slotProps is always an object, as this is what will be passed to the slot if you use multiple v-bind directives on the slot.
This issue is rather pointing out the difference in behavior of the slot when v-if is present or not present.

The two patches

Our patch+185 −3
packages/compiler-core/__tests__/transforms/vFor.spec.tsindex 34991445c..7173731d1 100644@@ -941,6 +941,51 @@ describe('compiler: v-for', () => {       expect(generate(root).code).toMatchSnapshot()     }) +    test('keyed template v-for w/ <slot/> w/ single v-bind object should not merge key into slot props', () => {+      const {+        root,+        node: { codegenNode },+      } = parseWithForTransform(+        '<template v-for="item in items" :key="item.id"><slot v-bind="item.list"/></template>',+      )+      expect(+        assertSharedCodegen(codegenNode, true, true /* custom return */),+      ).toMatchObject({+        source: { content: `items` },+        params: [{ content: `item` }],+        returns: {+          type: NodeTypes.JS_CALL_EXPRESSION,+          callee: RENDER_SLOT,+          arguments: [+            '$slots',+            '"default"',+            {},+            'undefined',+            'undefined',+            { content: 'item.id' },+          ],+        },+      })+      const code = generate(root).code+      expect(code).not.toContain('mergeProps')+      expect(code).not.toContain('ref_for')+      expect(code).toMatch(+        `_renderSlot($slots, "default", _normalizeProps(_guardReactiveProps(item.list)), undefined, undefined, item.id)`,+      )+    })++    test('v-for on <slot/> w/ single v-bind object should not merge ref_for into slot props', () => {+      const { root } = parseWithForTransform(+        '<slot v-for="item in items" v-bind="item.list"/>',+      )+      const code = generate(root).code+      expect(code).not.toContain('mergeProps')+      expect(code).not.toContain('ref_for')+      expect(code).toMatch(+        `_renderSlot($slots, "default", _normalizeProps(_guardReactiveProps(item.list)))`,+      )+    })+     test('v-for on <slot/>', () => {       const {         root,packages/compiler-core/__tests__/transforms/vIf.spec.tsindex fe3aef714..4d776befa 100644@@ -527,6 +527,59 @@ describe('compiler: v-if', () => {       expect(generate(root).code).toMatchSnapshot()     }) +    test('v-if on <slot/> w/ single v-bind object should not merge key into slot props', () => {+      const {+        root,+        node: { codegenNode },+      } = parseWithIfTransform(`<slot v-if="ok" v-bind="items"></slot>`)+      // the branch key is passed to renderSlot() separately so the bound value+      // (e.g. an array) is passed to the slot as-is+      expect(codegenNode.consequent).toMatchObject({+        type: NodeTypes.JS_CALL_EXPRESSION,+        callee: RENDER_SLOT,+        arguments: [+          '$slots',+          '"default"',+          {+            callee: NORMALIZE_PROPS,+            arguments: [{ arguments: [{ content: 'items' }] }],+          },+          'undefined',+          'undefined',+          { content: '0' },+        ],+      })+      const code = generate(root).code+      expect(code).not.toContain('mergeProps')+      expect(code).toMatch(+        `_renderSlot($slots, "default", _normalizeProps(_guardReactiveProps(items)), undefined, undefined, 0)`,+      )+    })++    test('v-if on <slot/> w/ v-bind object and other props should still merge key into slot props', () => {+      const {+        node: { codegenNode },+      } = parseWithIfTransform(+        `<slot v-if="ok" v-bind="obj" foo="bar"></slot>`,+      )+      expect(codegenNode.consequent).toMatchObject({+        type: NodeTypes.JS_CALL_EXPRESSION,+        callee: RENDER_SLOT,+        arguments: [+          '$slots',+          '"default"',+          {+            callee: MERGE_PROPS,+            arguments: [+              createObjectMatcher({ key: `[0]` }),+              { content: 'obj' },+              createObjectMatcher({ foo: 'bar' }),+            ],+          },+        ],+      })+    })+     test('v-if + v-else', () => {       const {         root,packages/compiler-core/src/ast.tsindex e3cc5304d..76d73ed5b 100644@@ -488,7 +488,7 @@ export interface DirectiveArgumentNode extends ArrayExpression { export interface RenderSlotCall extends CallExpression {   callee: typeof RENDER_SLOT   arguments:-    // $slots, name, props, fallback+    // $slots, name, props, fallback, noSlotted, key     | [string, string | ExpressionNode]     | [string, string | ExpressionNode, PropsExpression]     | [packages/compiler-core/src/transforms/transformElement.tsindex 40f08d45b..b922c944d 100644@@ -638,7 +638,12 @@ export function buildProps(             }              // #10696 in case a v-bind object contains ref-            pushRefVForMarker()+            // skipped for slot outlets: their props are passed to the slot+            // function as data, and merging the marker would convert the bound+            // value (e.g. an array) into an object+            if (node.tagType !== ElementTypes.SLOT) {+              pushRefVForMarker()+            }             pushMergeArg()             mergeArgs.push(exp)           } else {packages/compiler-core/src/utils.tsindex aa426bbab..6bee6318c 100644@@ -445,6 +445,18 @@ export function injectProp(       props.properties.unshift(prop)     }     propsWithInjection = props+  } else if (+    node.type === NodeTypes.JS_CALL_EXPRESSION &&+    prop.key.type === NodeTypes.SIMPLE_EXPRESSION &&+    prop.key.content === 'key'+  ) {+    // <slot v-bind="obj"/> with an injected key (v-if branch / v-for key):+    // merging the key into the slot props would convert the bound value+    // (e.g. an array) into an object, so pass it to renderSlot() separately.+    const args = node.arguments as CallExpression['arguments']+    for (let i = args.length; i < 5; i++) args.push('undefined')+    args[5] = prop.value+    return   } else {     // single v-bind with expression, return a merged replacement     propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [packages/runtime-core/__tests__/hydration.spec.tsindex 89fa5e829..099dbd525 100644@@ -583,6 +583,31 @@ describe('SSR hydration', () => {     )   }) +  test('conditional slot outlet w/ v-bind array', async () => {+    const show = ref(true)+    const Child = {+      setup() {+        return { show, items: ['a', 'b'] }+      },+      template: `<div><slot v-if="show" v-bind="items"/><slot v-else v-bind="items"/></div>`,+    }+    const App = {+      components: { Child },+      template: `<Child v-slot="p">{{ Array.isArray(p) }}:{{ p.join(',') }}</Child>`,+    }+    const container = document.createElement('div')+    const html = await renderToString(h(App))+    expect(html).toBe('<div><!--[-->true:a,b<!--]--></div>')+    container.innerHTML = html+    createSSRApp(App).mount(container)+    expect(`Hydration`).not.toHaveBeenWarned()+    expect(container.innerHTML).toBe(html)+    show.value = false+    await nextTick()+    // the v-else branch is freshly mounted with text fragment anchors+    expect(container.innerHTML).toBe('<div>true:a,b</div>')+  })+   test('Teleport unmount (full integration)', async () => {     const Comp1 = {       template: `packages/runtime-core/src/helpers/renderSlot.tsindex 8f65f8af4..4c9d2e428 100644@@ -32,6 +32,10 @@ export function renderSlot(   // the compiler and guaranteed to be a function returning an array   fallback?: () => VNodeArrayChildren,   noSlotted?: boolean,+  // branch key injected by the compiler (v-if / keyed template v-for) when the+  // slot props come from a single `v-bind="obj"`, kept separate so the bound+  // value (e.g. an array) is passed to the slot as-is+  key?: PropertyKey, ): VNode {   if (     currentRenderingInstance!.ce ||@@ -48,7 +52,7 @@ export function renderSlot(       openBlock(),       createBlock(         Fragment,-        null,+        key != null ? { key } : null,         [createVNode('slot', props, fallback && fallback())],         hasProps ? PatchFlags.BAIL : PatchFlags.STABLE_FRAGMENT,       )@@ -80,6 +84,7 @@ export function renderSlot(     const validSlotContent = slot && ensureValidVNode(slot(props))     const slotKey =       props.key ||+      key ||       // slot content array of a dynamic conditional slot may have a branch       // key attached in the `createSlots` helper, respect that       (validSlotContent && (validSlotContent as any).key)packages/vue/__tests__/index.spec.tsindex 6eeff41dd..4392be778 100644@@ -311,4 +311,41 @@ describe('compiler + runtime integration', () => {     app.mount(root)     expect(root.innerHTML).toBe('<div>60000000100000111</div>')   })++  test('conditional slot outlet should pass v-bind array to the slot as-is', async () => {+    const show = ref(true)+    const tag = (v: any) => (Array.isArray(v) ? 'array' : typeof v)+    const Child = {+      setup() {+        return {+          show,+          items: ['a', 'b'],+          groups: [{ id: 1, list: ['c', 'd'] }],+        }+      },+      template:+        `<slot v-bind="items"/>` ++        `<slot v-if="show" v-bind="items"/><slot v-else v-bind="items"/>` ++        `<template v-for="g in groups" :key="g.id"><slot v-bind="g.list"/></template>` ++        `<template v-for="g in groups"><slot v-bind="g.list"/></template>` ++        `<slot v-for="g in groups" v-bind="g.list"/>`,+    }+    const App = {+      components: { Child },+      setup() {+        return { tag }+      },+      template: `<Child v-slot="p">[{{ tag(p) }}:{{ p.join(',') }}]</Child>`,+    }+    const container = document.createElement('div')+    createApp(App).mount(container)+    expect(container.innerHTML).toBe(+      `[array:a,b][array:a,b][array:c,d][array:c,d][array:c,d]`,+    )+    show.value = false+    await nextTick()+    expect(container.innerHTML).toBe(+      `[array:a,b][array:a,b][array:c,d][array:c,d][array:c,d]`,+    )+  }) }) 
Merged fix · PR #15051+255 −11
packages/compiler-core/__tests__/transforms/__snapshots__/transformElement.spec.ts.snapindex 3da778eb6..c07237de2 100644@@ -121,6 +121,20 @@ return function render(_ctx, _cache) { }" `; +exports[`compiler: v-for > codegen > template v-for key injection with single slot child 1`] = `+"const _Vue = Vue++return function render(_ctx, _cache) {+  with (_ctx) {+    const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, renderSlot: _renderSlot } = _Vue++    return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => {+      return _renderSlot($slots, "default", {}, undefined, undefined, item.id)+    }), 128 /* KEYED_FRAGMENT */))+  }+}"+`;+ exports[`compiler: v-for > codegen > template v-for w/ <slot/> 1`] = ` "const _Vue = Vue packages/compiler-core/__tests__/transforms/__snapshots__/vFor.spec.ts.snapindex 3da778eb6..c07237de2 100644@@ -121,6 +121,20 @@ return function render(_ctx, _cache) { }" `; +exports[`compiler: v-for > codegen > template v-for key injection with single slot child 1`] = `+"const _Vue = Vue++return function render(_ctx, _cache) {+  with (_ctx) {+    const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, renderSlot: _renderSlot } = _Vue++    return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => {+      return _renderSlot($slots, "default", {}, undefined, undefined, item.id)+    }), 128 /* KEYED_FRAGMENT */))+  }+}"+`;+ exports[`compiler: v-for > codegen > template v-for w/ <slot/> 1`] = ` "const _Vue = Vue packages/compiler-core/__tests__/transforms/__snapshots__/vIf.spec.ts.snapindex 65ee73c46..ed2c8e540 100644@@ -80,7 +80,7 @@ return function render(_ctx, _cache) {     const { renderSlot: _renderSlot, createCommentVNode: _createCommentVNode } = _Vue      return ok-      ? _renderSlot($slots, "default", { key: 0 })+      ? _renderSlot($slots, "default", {}, undefined, undefined, 0)       : _createCommentVNode("v-if", true)   } }"@@ -140,7 +140,21 @@ return function render(_ctx, _cache) {     const { renderSlot: _renderSlot, createCommentVNode: _createCommentVNode } = _Vue      return ok-      ? _renderSlot($slots, "default", { key: 0 })+      ? _renderSlot($slots, "default", {}, undefined, undefined, 0)+      : _createCommentVNode("v-if", true)+  }+}"+`;++exports[`compiler: v-if > codegen > v-if on <slot/> with v-bind 1`] = `+"const _Vue = Vue++return function render(_ctx, _cache) {+  with (_ctx) {+    const { normalizeProps: _normalizeProps, guardReactiveProps: _guardReactiveProps, renderSlot: _renderSlot, createCommentVNode: _createCommentVNode } = _Vue++    return ok+      ? _renderSlot($slots, "default", _normalizeProps(_guardReactiveProps(items)), undefined, undefined, 0)       : _createCommentVNode("v-if", true)   } }"packages/compiler-core/__tests__/transforms/vFor.spec.tsindex 34991445c..839d9d358 100644@@ -918,6 +918,34 @@ describe('compiler: v-for', () => {       expect(generate(root).code).toMatchSnapshot()     }) +    test('template v-for key injection with single slot child', () => {+      const {+        root,+        node: { codegenNode },+      } = parseWithForTransform(+        '<template v-for="item in items" :key="item.id"><slot/></template>',+      )+      expect(+        assertSharedCodegen(codegenNode, true, true /* custom return */),+      ).toMatchObject({+        source: { content: `items` },+        params: [{ content: `item` }],+        returns: {+          type: NodeTypes.JS_CALL_EXPRESSION,+          callee: RENDER_SLOT,+          arguments: [+            '$slots',+            '"default"',+            '{}',+            'undefined',+            'undefined',+            { content: 'item.id' },+          ],+        },+      })+      expect(generate(root).code).toMatchSnapshot()+    })+     // #1907     test('template v-for key injection with single child', () => {       const {packages/compiler-core/__tests__/transforms/vIf.spec.tsindex fe3aef714..677f6b55b 100644@@ -3,6 +3,7 @@ import { transform } from '../../src/transform' import { transformIf } from '../../src/transforms/vIf' import { transformElement } from '../../src/transforms/transformElement' import { transformSlotOutlet } from '../../src/transforms/transformSlotOutlet'+import { transformBind } from '../../src/transforms/vBind' import {   type CommentNode,   type ConditionalExpression,@@ -509,7 +510,14 @@ describe('compiler: v-if', () => {       expect(codegenNode.consequent).toMatchObject({         type: NodeTypes.JS_CALL_EXPRESSION,         callee: RENDER_SLOT,-        arguments: ['$slots', '"default"', createObjectMatcher({ key: `[0]` })],+        arguments: [+          '$slots',+          '"default"',+          '{}',+          'undefined',+          'undefined',+          { content: '0' },+        ],       })       expect(generate(root).code).toMatchSnapshot()     })@@ -522,7 +530,41 @@ describe('compiler: v-if', () => {       expect(codegenNode.consequent).toMatchObject({         type: NodeTypes.JS_CALL_EXPRESSION,         callee: RENDER_SLOT,-        arguments: ['$slots', '"default"', createObjectMatcher({ key: `[0]` })],+        arguments: [+          '$slots',+          '"default"',+          '{}',+          'undefined',+          'undefined',+          { content: '0' },+        ],+      })+      expect(generate(root).code).toMatchSnapshot()+    })++    test('v-if on <slot/> with v-bind', () => {+      const {+        root,+        node: { codegenNode },+      } = parseWithIfTransform(`<slot v-if="ok" v-bind="items"></slot>`, {+        directiveTransforms: {+          bind: transformBind,+        },+      })+      expect(codegenNode.consequent).toMatchObject({+        type: NodeTypes.JS_CALL_EXPRESSION,+        callee: RENDER_SLOT,+        arguments: [+          '$slots',+          '"default"',+          {+            type: NodeTypes.JS_CALL_EXPRESSION,+            callee: NORMALIZE_PROPS,+          },+          'undefined',+          'undefined',+          { content: '0' },+        ],       })       expect(generate(root).code).toMatchSnapshot()     })packages/compiler-core/src/ast.tsindex e3cc5304d..e6da01edb 100644@@ -488,14 +488,29 @@ export interface DirectiveArgumentNode extends ArrayExpression { export interface RenderSlotCall extends CallExpression {   callee: typeof RENDER_SLOT   arguments:-    // $slots, name, props, fallback+    // $slots, name, props, fallback, noSlotted, branchKey     | [string, string | ExpressionNode]-    | [string, string | ExpressionNode, PropsExpression]+    | [string, string | ExpressionNode, PropsExpression | '{}']     | [         string,         string | ExpressionNode,         PropsExpression | '{}',-        TemplateChildNode[],+        FunctionExpression | string,+      ]+    | [+        string,+        string | ExpressionNode,+        PropsExpression | '{}',+        FunctionExpression | string,+        string,+      ]+    | [+        string,+        string | ExpressionNode,+        PropsExpression | '{}',+        FunctionExpression | string,+        string,+        JSChildNode,       ] } packages/compiler-core/src/utils.tsindex aa426bbab..025f6c32d 100644@@ -392,6 +392,10 @@ export function injectProp(   prop: Property,   context: TransformContext, ): void {+  if (node.type !== NodeTypes.VNODE_CALL && injectSlotKey(node, prop)) {+    return+  }+   let propsWithInjection: ObjectExpression | CallExpression | undefined   /**    * 1. mergeProps(...)@@ -473,6 +477,36 @@ export function injectProp(   } } +function injectSlotKey(node: RenderSlotCall, prop: Property): boolean {+  if (+    prop.key.type !== NodeTypes.SIMPLE_EXPRESSION ||+    prop.key.content !== 'key'+  ) {+    return false+  }++  // If the slot already has a user-provided key, avoid injecting the branch+  // key so the user key keeps its existing priority.+  const props = node.arguments[2]+  if (props && !isString(props)) {+    const [unnormalizedProps] = getUnnormalizedProps(props as PropsExpression)+    if (+      unnormalizedProps &&+      !isString(unnormalizedProps) &&+      unnormalizedProps.type === NodeTypes.JS_OBJECT_EXPRESSION &&+      hasProp(prop, unnormalizedProps)+    ) {+      return true+    }+  }++  node.arguments[2] ||= '{}'+  node.arguments[3] ||= 'undefined'+  node.arguments[4] ||= 'undefined'+  node.arguments[5] = prop.value+  return true+}+ // check existing key to avoid overriding user provided keys function hasProp(prop: Property, props: ObjectExpression) {   let result = falsepackages/runtime-core/__tests__/helpers/renderSlot.spec.tsindex bc0678b51..f359f431c 100644@@ -38,6 +38,83 @@ describe('renderSlot', () => {     expect(vnode.key).toBe('_default')   }) +  it('should allow symbol values for compiler-injected slot keys', () => {+    const key = Symbol()+    const vnode = renderSlot(+      { default: () => [h('div')] },+      'default',+      {},+      undefined,+      undefined,+      key,+    )+    expect(vnode.key).toBe('_default')+  })++  it('should not expose compiler-injected slot keys to slot props', () => {+    let receivedProps: any+    const props = ['foo', 'bar']+    const vnode = renderSlot(+      {+        default: props => {+          receivedProps = props+          return [h('div')]+        },+      },+      'default',+      props as any,+      undefined,+      undefined,+      'branch',+    )++    expect(receivedProps).toBe(props)+    expect(receivedProps).not.toHaveProperty('key')+    expect(vnode.key).toBe('branch')+  })++  it('should prefer user-provided slot prop keys over compiler-injected keys', () => {+    let receivedProps: any+    const props = { key: 'user' }+    const vnode = renderSlot(+      {+        default: props => {+          receivedProps = props+          return [h('div')]+        },+      },+      'default',+      props,+      undefined,+      undefined,+      'branch',+    )++    expect(receivedProps).toBe(props)+    expect(vnode.key).toBe('user')+  })++  it('should preserve compiler-injected slot keys in custom element mode', () => {+    setCurrentRenderingInstance({ type: {}, ce: {} } as any)++    let vnode = renderSlot({}, 'default', {}, undefined, undefined, 0)+    let slot = (vnode.children as any[])[0]+    expect(slot.type).toBe('slot')+    expect(slot.key).toBe(0)+    expect(vnode.patchFlag).toBe(PatchFlags.BAIL)++    vnode = renderSlot(+      {},+      'default',+      { key: 'user' },+      undefined,+      undefined,+      'branch',+    )+    slot = (vnode.children as any[])[0]+    expect(slot.key).toBe('user')+  })+   it('should render slot fallback', () => {     const vnode = renderSlot({}, 'default', { key: 'foo' }, () => ['fallback'])     expect(vnode.children).toEqual(['fallback'])packages/runtime-core/src/helpers/renderSlot.tsindex 8f65f8af4..2a68ee3e4 100644@@ -16,7 +16,7 @@ import {   isVNode,   openBlock, } from '../vnode'-import { PatchFlags, SlotFlags, isSymbol } from '@vue/shared'+import { PatchFlags, SlotFlags, extend, isSymbol } from '@vue/shared' import { warn } from '../warning' import { isAsyncWrapper } from '../apiAsyncComponent' @@ -32,6 +32,7 @@ export function renderSlot(   // the compiler and guaranteed to be a function returning an array   fallback?: () => VNodeArrayChildren,   noSlotted?: boolean,+  branchKey?: PropertyKey, ): VNode {   if (     currentRenderingInstance!.ce ||@@ -39,17 +40,21 @@ export function renderSlot(       isAsyncWrapper(currentRenderingInstance!.parent) &&       currentRenderingInstance!.parent.ce)   ) {-    const hasProps = Object.keys(props).length > 0+    const slotProps =+      branchKey != null && props.key == null+        ? extend({}, props, { key: branchKey })+        : props+    const hasProps = Object.keys(slotProps).length > 0     // in custom element mode, render <slot/> as actual slot outlets     // wrap it with a fragment because in shadowRoot: false mode the slot     // element gets replaced by injected content-    if (name !== 'default') props.name = name+    if (name !== 'default') slotProps.name = name     return (       openBlock(),       createBlock(         Fragment,         null,-        [createVNode('slot', props, fallback && fallback())],+        [createVNode('slot', slotProps, fallback && fallback())],         hasProps ? PatchFlags.BAIL : PatchFlags.STABLE_FRAGMENT,       )     )@@ -80,6 +85,7 @@ export function renderSlot(     const validSlotContent = slot && ensureValidVNode(slot(props))     const slotKey =       props.key ||+      branchKey ||       // slot content array of a dynamic conditional slot may have a branch       // key attached in the `createSlots` helper, respect that       (validSlotContent && (validSlotContent as any).key)