DEV: call destroy() on widget when glue is cleaned up (#8338)

This commit is contained in:
Joffrey JAFFEUX 2019-11-13 09:28:43 +01:00 committed by GitHub
parent 3b36326cb7
commit 38a18b7aa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -54,6 +54,18 @@ export default class WidgetGlue {
}
cleanUp() {
const widgets = [];
const findWidgets = widget => {
widget.vnode.children.forEach(child => {
if (child.constructor.name === "CustomWidget") {
widgets.push(child);
findWidgets(child, widgets);
}
});
};
findWidgets(this._tree, widgets);
widgets.reverse().forEach(widget => widget.destroy());
cancel(this._timeout);
}
}