mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] portal: ensure that destroy is synchronous
This commit is contained in:
committed by
Aaron Bohy
parent
5a2c769eab
commit
eab0caa6cb
+8
-7
@@ -35,9 +35,11 @@ class VPortal extends VText implements Partial<VNode<VPortal>> {
|
||||
this.realBDom!.beforeRemove();
|
||||
}
|
||||
remove() {
|
||||
super.remove();
|
||||
this.realBDom!.remove();
|
||||
this.realBDom = null;
|
||||
if (this.realBDom) {
|
||||
super.remove();
|
||||
this.realBDom!.remove();
|
||||
this.realBDom = null;
|
||||
}
|
||||
}
|
||||
|
||||
patch(other: VPortal) {
|
||||
@@ -64,10 +66,9 @@ export class Portal extends Component {
|
||||
const node = this.__owl__;
|
||||
const renderFn = node.renderFn;
|
||||
node.renderFn = () => new VPortal(this.props.target, renderFn());
|
||||
onWillUnmount(async () => {
|
||||
await Promise.resolve();
|
||||
if (node.bdom && (node.bdom as any).realBDom) {
|
||||
(node.bdom as any).realBDom.remove();
|
||||
onWillUnmount(() => {
|
||||
if (node.bdom) {
|
||||
node.bdom.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user