fixed minor theoretical UI bug

main
Inga 🏳‍🌈 2 weeks ago
parent 6ec1a46aca
commit e347f48c19
  1. 11
      src/frontend/components/board-game.ts

@ -39,15 +39,16 @@ class BoardGameComponent extends HTMLElement {
for (const [slotName, templateName] of Object.entries(slotTemplateNames)) { for (const [slotName, templateName] of Object.entries(slotTemplateNames)) {
this.querySelectorAll(`.${slotName}`).forEach((slot) => { this.querySelectorAll(`.${slotName}`).forEach((slot) => {
if (slot.getAttribute("data-current-template") !== templateName) { if (slot.getAttribute("data-current-template") !== templateName) {
while (slot.lastChild) {
slot.removeChild(slot.lastChild);
}
const template = this.querySelector(`template[name="${templateName}"]`); const template = this.querySelector(`template[name="${templateName}"]`);
if (template) { if (template) {
while (slot.lastChild) {
slot.removeChild(slot.lastChild);
}
slot.appendChild(template.content.cloneNode(true)); slot.appendChild(template.content.cloneNode(true));
slot.setAttribute("data-current-template", templateName);
} }
slot.setAttribute("data-current-template", templateName);
} }
}); });
} }

Loading…
Cancel
Save