From 37a81ba594c2b848b8ecec805527ee8766f1ed14 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 14 Feb 2021 19:19:25 +0300 Subject: [PATCH] SingleUseDialog: destroy existing widget with same id on create --- js/SingleUseDialog.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/js/SingleUseDialog.js b/js/SingleUseDialog.js index 944f24c6f..2de6f83ff 100644 --- a/js/SingleUseDialog.js +++ b/js/SingleUseDialog.js @@ -1,6 +1,17 @@ +/* eslint-disable prefer-rest-params */ /* global dijit, define */ define(["dojo/_base/declare", "dijit/Dialog"], function (declare) { return declare("fox.SingleUseDialog", dijit.Dialog, { + create: function(params) { + const extant = dijit.byId(params.id); + + if (extant) { + console.warn('SingleUseDialog: destroying existing widget:', params.id, '=', extant) + extant.destroyRecursive(); + } + + return this.inherited(arguments); + }, onHide: function() { this.destroyRecursive(); }