Stencil version:
I'm submitting a:
Current behavior:
When using multiple nested components with slots in them, if one of the slots is not rendered, the inner component is still rendered.
Expected behavior:
The inner component should not be rendered
Steps to reproduce:
Have multiple components with slots nested, in one of the middle components do not render the slot with a if clause, i.e. return (<div><h1>Hello</h1>{false && <slot/>}</div>)
Related code:
<micro-header>
<micro-menu apps={apps}>
<micro-user />
</micro-menu>
</micro-header>
<micro-header> has a slot where <micro-menu> is rendered. <micro-menu> has a slot where <micro-user> is rendered.
the render function of <micro-menu> returns the following:
return (
<div>
<div class="micro-hamburger" onClick={this.handleHamburgerClick}>
<i class="material-icons">dehaze</i>
</div>
{this.visible && ([
<div class="micro-menu">
<ul>
{this.apps.map(app => <li>{app.name}</li>)}
</ul>
<slot />
</div>,
<micro-backdrop onClick={this.handleBackdropClick} />
])}
</div>
);
visible is false by default. But currently the micro-user component is rendered even before the visible flag is set to true. It seems that it always tries to render enclosed components wether it finds the slot or not. if it does not find a <slot> it just renders in the root of the upper component.
Other information:
Stencil version:
I'm submitting a:
Current behavior:
When using multiple nested components with slots in them, if one of the slots is not rendered, the inner component is still rendered.
Expected behavior:
The inner component should not be rendered
Steps to reproduce:
Have multiple components with slots nested, in one of the middle components do not render the slot with a if clause, i.e.
return (<div><h1>Hello</h1>{false && <slot/>}</div>)Related code:
<micro-header>has a slot where<micro-menu>is rendered.<micro-menu>has a slot where<micro-user>is rendered.the render function of
<micro-menu>returns the following:visibleisfalseby default. But currently themicro-usercomponent is rendered even before thevisibleflag is set to true. It seems that it always tries to render enclosed components wether it finds the slot or not. if it does not find a<slot>it just renders in the root of the upper component.Other information: