forcedotcom / lwc-dev-server-feedback

LWC Local Development
BSD 3-Clause "New" or "Revised" License
45 stars 10 forks source link

Using <slot></slot> doesn't render anything from parent component #77

Closed lukethacoder closed 4 years ago

lukethacoder commented 4 years ago

Describe the bug

<slot></slot> does not render markup.

The following renders fine once it is pushed to an org.

<!-- customButton.html -->
<template>
  <button data-type={type}>
    Button: <slot></slot>
  </button>
</template>
<!-- anotherComponent.html -->
<div class="slds-col slds-size_12-of-12">
  <c-custom-button type="primary">
    <p>primary</p>
  </c-custom-button>
</div>

Above example renders the Button: text on the child item, but not the <p>primary</p> from the parent component.

To Reproduce Steps to reproduce the behavior:

  1. Create LWC with a <slot></slot>
  2. Use LWC and pass markup into the slot.
  3. LWC slot content not rendered

Expected behavior <slot></slot> should work as it currently does when viewing on platform.

Desktop (please complete the following information):

lukethacoder commented 4 years ago

well... looks like this was a bug on my end. was incorrectly referencing the @api value in the connectedCallback(), which silently bricks your component.