diff options
author | Andrew Dolgov <[email protected]> | 2021-02-14 19:19:25 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-02-14 19:19:25 +0300 |
commit | 37a81ba594c2b848b8ecec805527ee8766f1ed14 (patch) | |
tree | faa01bd78d1eaba241d0b03c32207fbf2e53bbef /js | |
parent | ff6031d3c914fa2c7ac514243394fa70a56c6bd7 (diff) |
SingleUseDialog: destroy existing widget with same id on create
Diffstat (limited to 'js')
-rw-r--r-- | js/SingleUseDialog.js | 11 |
1 files changed, 11 insertions, 0 deletions
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(); } |