mirror of
https://github.com/discourse/discourse.git
synced 2025-02-18 01:05:00 +00:00
DEV: prevents hooks to create leaks on widgets (#14207)
Before this, mounted widgets were not correctly unhooked and would keep a reference to a custom widget object.
This commit is contained in:
parent
55739fd3c9
commit
a2ca430068
@ -63,6 +63,9 @@ export default Component.extend({
|
|||||||
|
|
||||||
this._connected.forEach((v) => v.destroy());
|
this._connected.forEach((v) => v.destroy());
|
||||||
this._connected.length = 0;
|
this._connected.length = 0;
|
||||||
|
|
||||||
|
this._rootNode = patch(this._rootNode, diff(this._tree, null));
|
||||||
|
this._tree = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
|
@ -60,5 +60,8 @@ export default class WidgetGlue {
|
|||||||
traverseCustomWidgets(this._tree, (w) => w.destroy());
|
traverseCustomWidgets(this._tree, (w) => w.destroy());
|
||||||
|
|
||||||
cancel(this._timeout);
|
cancel(this._timeout);
|
||||||
|
|
||||||
|
this._rootNode = patch(this._rootNode, diff(this._tree, null));
|
||||||
|
this._tree = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user