Skip to content

[TwigComponent] Unexpected attribute parsing behavior #2455

Closed as not planned
@eokic

Description

@eokic

These may be two very different reports with different opinions for each, so please let me know if you'd like me to separate them.

Example 01: Passing attributes as-is

<twig:Comp {{ attributes }} /> {# ❌ original question/report #}
<twig:Comp {{ ...attributes }} /> {# ✅ the correct way #}

A realistic usecase for this is creating higher-order (wrapper) components.

Example 02

<twig:Comp
  {% if condition %}
    disabled
  {% endif %}
/>

Most notably, without these conditions, boolean attributes seem impossible (?), but would also just make the syntax more consistent with the way Twig is normally written.


Both result in:

Expected attribute name when parsing the "<twig:Comp" syntax.

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