A platform for community discussion. Free, open, simple.
DEV: prevents hooks to create leaks on widgets (#14207)
Joffrey JAFFEUXa2ca430068d9
diff --git a/app/assets/javascripts/discourse/app/components/mount-widget.js b/app/assets/javascripts/discourse/app/components/mount-widget.jsindex 136b28fe004..cc29cfb1ce3 100644--- a/app/assets/javascripts/discourse/app/components/mount-widget.js+++ b/app/assets/javascripts/discourse/app/components/mount-widget.js@@ -63,6 +63,9 @@ export default Component.extend({this._connected.forEach((v) => v.destroy());this._connected.length = 0;++ this._rootNode = patch(this._rootNode, diff(this._tree, null));+ this._tree = null;},willDestroyElement() {diff --git a/app/assets/javascripts/discourse/app/widgets/glue.js b/app/assets/javascripts/discourse/app/widgets/glue.jsindex 4795926e146..cf192f37fc1 100644--- a/app/assets/javascripts/discourse/app/widgets/glue.js+++ b/app/assets/javascripts/discourse/app/widgets/glue.js@@ -60,5 +60,8 @@ export default class WidgetGlue {traverseCustomWidgets(this._tree, (w) => w.destroy());cancel(this._timeout);++ this._rootNode = patch(this._rootNode, diff(this._tree, null));+ this._tree = null;}}