Skip to content

Functional component not receiving context when using the rest parameters #13182

Open
@s-montigny-desautels

Description

@s-montigny-desautels

Vue version

3.5.13

Link to minimal reproduction

https://play.vuejs.org/#eNp9UsFOwzAM/RWTSztpyoTgNAoI0CTgAAiQOBAOVet2HWlSJemoVPXfcdKt7ADc4vee7Wc7PbtqGr5tkS1ZYjNTNQ4sura5EKqqG20c9GCwgAEKo2uISBpN1I2umxEXjC98xJ0VTCihMq2sg9qWcO7z4+gWpdTwpo3Mj6KZUMlibEeNKHBYNzJ1SBFA4iuFF0DfU41hCHDoQHiyOJCzOXOWuhVVyTdWKxqk92rBMlJXEs1j4ypyI9gSAuO5lMx83QfMmRbnezxbY/b5C76xnccEezJo0WxRsIlzqSnRjfTq5QE7ek9krfNWkvof8hmtlq33OMquW5WT7QNdcHsXdl6p8tWuOofK7ofyRr1yCHrB6ER+UX+N/mP3hJ+GPKEG2uLufLS/6fDr/dlDUcHO/K2wC2yORdpKB0WrMt8k5pxTZTsbOxn6REbBOhYsr7Y0C3jy/fiDW6md5bv0Sx7P6DMMbPgGnPHYTg==

Steps to reproduce

Create a functional component like this

export default function(...args) {
  return h("div", args[1].slots.default?.())
}

What is expected?

The slots to be rendered.

What is actually happening?

The slots is not rendered, since null is passed as second argument to the function

System Info

System:
    OS: Linux 6.13 Fedora Linux 41 (Workstation Edition)
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
    Memory: 11.61 GB / 31.12 GB
    Container: Yes
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.14.0 - /usr/bin/node
    Yarn: 1.22.22 - ~/.local/share/pnpm/yarn
    npm: 10.9.2 - /usr/bin/npm
    pnpm: 10.7.0 - ~/.local/share/pnpm/pnpm
    bun: 1.2.4 - ~/.local/share/pnpm/bun
  Browsers:
    Chrome: 135.0.7049.52

Any additional comments?

The length of the function seems to be checked. Is this optimization necessary?

render.length > 1
? render(
__DEV__ ? shallowReadonly(props) : props,
__DEV__
? {
get attrs() {
markAttrsAccessed()
return shallowReadonly(attrs)
},
slots,
emit,
}
: { attrs, slots, emit },
)
: render(
__DEV__ ? shallowReadonly(props) : props,
null as any /* we know it doesn't need it */,
),

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions