SingleUseDialog: destroy existing widget with same id on create

This commit is contained in:
Andrew Dolgov 2021-02-14 19:19:25 +03:00
parent ff6031d3c9
commit 37a81ba594
1 changed files with 11 additions and 0 deletions

View File

@ -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();
}