Problem/Motivation

When I use a component inside another component, I have to pass slots like in this example: https://git.drupalcode.org/project/sdc_examples/-/blob/1.x/components/si...

sdc_examples:heading.component.yml

...
slots:
  heading_text:
    title: Text
...

sdc_examples:side-by-side.twig

...
  {% set heading_text %}
    {% block sbs_heading_text %}{% endblock %}
  {% endset %}
...
    {% embed 'sdc_examples:heading' with {
    ...
    %}
      {% block heading_text %}
        {{ heading_text }}    
      {% endblock %}
    {% endembed %}

When I run this with storybook dev server, I get an watchdog error from "storybook":

An exception has been thrown during the compilation of a template ("We found an unexpected slot that is not declared: [heading_text]. Declare them in "side-by-side.component.yml").

The only way to make this go away, was to add the embedded component's slot into the embedding component's definition yml:

side-by-side.component.yml

...
slots:
  sbs_body:
    title: Body
    required: true
  sbs_heading_text:
    title: Heading Body
    required: true
  heading_text:
    title: dummy - do not use

Comments

miiimooo created an issue. See original summary.

e0ipso’s picture

Status: Active » Fixed

This is being addressed in Drupal core.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.