mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
fix issue with mounted widget without proper vnode
This commit is contained in:
@@ -133,8 +133,9 @@ export class Widget<T extends WEnv> {
|
||||
return Promise.all(promises).then(() => vnode);
|
||||
}
|
||||
|
||||
_mount(el: HTMLElement) {
|
||||
this.el = el;
|
||||
_mount(vnode: VNode) {
|
||||
this.el = <HTMLElement>vnode.elm;
|
||||
this._.vnode = vnode;
|
||||
if (this._.parent) {
|
||||
if (this._.parent._.isMounted) {
|
||||
this._.isMounted = true;
|
||||
|
||||
@@ -685,7 +685,7 @@ const widgetDirective: Directive = {
|
||||
`let _${widgetID} = new context.widgets['${value}'](context, ${props})`
|
||||
);
|
||||
ctx.addLine(
|
||||
`let def${defID} = _${widgetID}._start().then(() => _${widgetID}._render()).then(vnode=>{Object.assign(_${dummyID}, vnode);_${dummyID}.key="${dummyID}";_${dummyID}.data.hook = {create(_,vn){_${widgetID}._mount(vn.elm)}}})`
|
||||
`let def${defID} = _${widgetID}._start().then(() => _${widgetID}._render()).then(vnode=>{Object.assign(_${dummyID}, vnode);_${dummyID}.key="${dummyID}";_${dummyID}.data.hook = {create(_,vn){_${widgetID}._mount(vn)}}})`
|
||||
);
|
||||
ctx.addLine(`extra.promises.push(def${defID})`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user