mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] portal: properly handle errors
Before this commit, Portal overrode the _render function for its component node, which means it bypassed the error handling mechanism that was implemented in that method. It could have been fixed by duplicating the error handling code as well, but a better solution in my opinion is to simply override the renderFn function. This is closer to the actual intent of the portal implementation: wrap the result of the rendering in a VPortal vnode.
This commit is contained in:
committed by
Aaron Bohy
parent
4b170b9b45
commit
52d0526ddd
+5
-9
@@ -1,7 +1,6 @@
|
||||
import type { ComponentNode } from "./component/component_node";
|
||||
import { Component } from "./component/component";
|
||||
import { xml } from "./app/template_set";
|
||||
import { BDom, text, VNode } from "./blockdom";
|
||||
import { Component } from "./component/component";
|
||||
|
||||
const VText: any = text("").constructor;
|
||||
|
||||
@@ -60,12 +59,9 @@ export class Portal extends Component {
|
||||
slots: true,
|
||||
};
|
||||
|
||||
constructor(props: any, env: any, node: ComponentNode) {
|
||||
super(props, env, node);
|
||||
node._render = function (fiber: any) {
|
||||
const bdom = new VPortal(props.target, this.renderFn());
|
||||
fiber.bdom = bdom;
|
||||
fiber.root.counter--;
|
||||
};
|
||||
setup() {
|
||||
const node = this.__owl__;
|
||||
const renderFn = node.renderFn;
|
||||
node.renderFn = () => new VPortal(this.props.target, renderFn());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user