fix code demo with empty slot (#360)

* fix code demo with empty slot

* prettier
This commit is contained in:
Konnor Rogers
2024-12-19 14:12:55 -05:00
committed by GitHub
parent 63a2367cc5
commit 486b0649e0

View File

@@ -77,6 +77,11 @@ export default class WaCodeDemo extends WebAwesomeElement {
private readonly hasSlotController = new HasSlotController(this, 'preview');
firstUpdated() {
// This works around a bug where if you have no slotted preview, initial previews will not load.
this.requestUpdate();
}
render() {
// NOTE We don't want to render the contents of the code element anywhere if a custom preview is provided.
// That way, providing a custom preview can also be used to sanitize the code.