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:
Joffrey JAFFEUX 2021-09-01 14:34:20 +02:00 committed by GitHub
parent 55739fd3c9
commit a2ca430068
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -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() {

View File

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