Skip to content

Props not being passed to some slots  #7610

@salami-art

Description

@salami-art

What version of astro are you using?

2.8.0

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

yarn

What operating system are you using?

Mac

What browser are you using?

Chrome

Describe the Bug

I am attaching a stripped-down example of what I am experiencing.

Basically, at least one of the slots I'm trying to render does not receive props ( hence the error ), usually the one named after. I found out about this when trying to build a component that receives multiple slots, all were passed props, except the one named after (or anything starting with A, weirdly enough) .
If I remove the props destructuring from the slotted function the slot is rendered.

By debugging the code into node_modules/astro/dist/core/render/result.js, I found out that that slot's expressions sometimes has an Object [Generator] {} as its first member (therefore the getFunctionExpression returns undefined because the expressions length is greater than 1) and I don't know where it comes from. However, sometimes, by changing the slot's name from after to something else the Object [Generator] {} disappears

What's the expected result?

I would like the props to be passed to all slots. It seems like the issue has something to do with my example not having a tag and the after slot being the first in alphabetical order ( but I have seen it happening even if the tag is included in other examples )

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-927mjd?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P4: importantViolate documented behavior or significantly impacts performance (priority)feat: renderingRelated to prop serialization, html escaping, and framework components (scope)pkg: astroRelated to the core `astro` package (scope)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions