Closed (fixed)
Project:
Storybook
Version:
1.x-dev
Component:
Storybook
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Jul 2024 at 08:23 UTC
Updated:
23 Sep 2024 at 21:49 UTC
Jump to comment: Most recent
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
Comment #2
e0ipsoThis is being addressed in Drupal core.