-
Notifications
You must be signed in to change notification settings - Fork 79
Open
Labels
- P3: minor bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
What version of @astrojs/compiler
are you using?
2.12.2
What package manager are you using?
n/a
What operating system are you using?
n/a
Describe the Bug
The slot
attribute can be used to slot an item into an HTML <template>
(see “Using templates and slots” on MDN).
In a .astro
component, this works for a simple case:
<web-component>
<p slot="some-part">Contents</p>
</web-component>
The compiler preserves the slot
attribute in its output:
return $$render`${$$renderComponent($$result,'web-component','web-component',{},{"default": () => $$render`
${$$maybeRenderHead($$result)}<p slot="some-part">Contents</p>
`,})}`;
}, '<stdin>', undefined);
However, if we introduce some kind of expression, even a simple one:
<web-component>
{true && <p slot="some-part">Contents</p>}
</web-component>
The slot
attribute gets stripped from output:
return $$render`${$$renderComponent($$result,'web-component','web-component',{},{"default": () => $$render`
${true && $$render`${$$maybeRenderHead($$result)}<p>Contents</p>`}
`,})}`;
}, '<stdin>', undefined);
(The slot is visible in the AST and in the TSX, but missing in the TS transform.)
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-vlgkm5cp?file=src%2FComponent.astro,src%2Fpages%2Findex.astro
Metadata
Metadata
Assignees
Labels
- P3: minor bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)