From 70f712925cbf81d0207fd95238b3a543fc0fa2a3 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 11 Jul 2019 09:43:12 +0200 Subject: [PATCH] Fix modal dialog callback being called multiple times When the modal closes, we need to remove the DOM element. If not, we create a new EventListener associated with the modal each time the modal shows up. And basically when the user `Cancel` the modal, all the previous callback where the modal was used get called. That's pretty critical --- src/app/ui/modaldialog.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/ui/modaldialog.js b/src/app/ui/modaldialog.js index 17b6e5293c..f64cc69c16 100644 --- a/src/app/ui/modaldialog.js +++ b/src/app/ui/modaldialog.js @@ -82,6 +82,7 @@ module.exports = (title, content, ok, cancel, focusSelector, opts) => { function hide () { if (container) container.style.display = 'none' + if (container.parentElement) container.parentElement.removeChild(container) } function show () {