mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 00:37:06 +08: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.length = 0;
|
||||
|
||||
this._rootNode = patch(this._rootNode, diff(this._tree, null));
|
||||
this._tree = null;
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user