diff --git a/src/frontend/components/board-game.ts b/src/frontend/components/board-game.ts index 672f6ec..f23a1be 100644 --- a/src/frontend/components/board-game.ts +++ b/src/frontend/components/board-game.ts @@ -39,15 +39,16 @@ class BoardGameComponent extends HTMLElement { for (const [slotName, templateName] of Object.entries(slotTemplateNames)) { this.querySelectorAll(`.${slotName}`).forEach((slot) => { if (slot.getAttribute("data-current-template") !== templateName) { + while (slot.lastChild) { + slot.removeChild(slot.lastChild); + } + const template = this.querySelector(`template[name="${templateName}"]`); if (template) { - while (slot.lastChild) { - slot.removeChild(slot.lastChild); - } - slot.appendChild(template.content.cloneNode(true)); - slot.setAttribute("data-current-template", templateName); } + + slot.setAttribute("data-current-template", templateName); } }); }