Skip to content

Adding <style> to a webc component breaks props #4214

@dan-f

Description

@dan-f

Operating system

macos

Eleventy

3.1.2

Describe the bug

  1. I ran this command with these flags '...'
$ npx @11ty/eleventy
  1. I used the following configuration and template syntax '....'

Parent template:

---
data:
  - foo: bar
---

<my-component webc:for="d in data" :@data="d"></div>

Child component:

<p @text="data.foo"></p>

<style>
  .anything {}
</style>
  1. I got this error or I expected this to happen and it didn’t
Original error message: Cannot read properties of undefined (reading 'foo')
Original error stack trace: Error: Check the dynamic attribute: `@text="data.foo"`.

Removing the <style> tag prevents this from happening. Based on print debugging, it appears that the webc child component is getting invoked twice when the <style> tag is included, and the second invocation fails to pass properties to the child.

This bug appears to be over a year old.

Reproduction Source Code URL

No response

Screenshots

No response

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