From e347f48c197fa861b427dfb9c1b60b6283ba79cc Mon Sep 17 00:00:00 2001 From: Inga Date: Sat, 7 Dec 2024 01:21:16 +0000 Subject: [PATCH] fixed minor theoretical UI bug --- src/frontend/components/board-game.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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); } }); }