From 98d8b9e9fe37e20173de529a25d7dda0ecac4a32 Mon Sep 17 00:00:00 2001 From: mystie Date: Sat, 28 Sep 2024 19:46:43 +0300 Subject: [PATCH] implement a nasty hack to fix a bug --- templates/index.html | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/templates/index.html b/templates/index.html index e3909a3..2ae515a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -170,7 +170,7 @@ {% else %}
  • {% endif %} -
  • +
  • {% endif %} @@ -292,9 +292,12 @@ const parsed = JSON.parse(jsonResponse); const alertType = event.detail.successful ? 'success' : 'danger'; msgType = event.detail.successful ? parsed.message : parsed.error; - const targetElementId = event.detail.target.id; + let targetElementId = event.detail.target.id; if (targetElementId != "question-count") { - if (document.getElementById(targetElementId) && targetElementId.includes("question-")) { + // WARNING: HACK + // we use this hack to avoid triggering the event listener twice when making a request to api.returnToInbox + if (document.getElementById(targetElementId) && event.detail.requestConfig.elt.dataset.returntoinbox === "") { + targetElementId = event.detail.requestConfig.elt.dataset.target; document.getElementById(targetElementId).outerHTML = ''; } if (msgType) {