mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] crash when rendering component before mounting
This commit makes sure that Owl does not crash when a component is created, then updated (for example, with a (observed) state change), and then, some moment later, mounted. The initial render is not useful, because it is not linked to a mounting action anyway. And it caused issues such as a crash when Owl tried to patch it to a non existing target
This commit is contained in:
@@ -373,6 +373,9 @@ export class Component<Props extends {} = any, T extends Env = Env> {
|
||||
async render(force: boolean = false): Promise<void> {
|
||||
const __owl__ = this.__owl__;
|
||||
const currentFiber = __owl__.currentFiber;
|
||||
if (!__owl__.vnode && !currentFiber) {
|
||||
return;
|
||||
}
|
||||
if (currentFiber && !currentFiber.isRendered && !currentFiber.isCompleted) {
|
||||
return scheduler.addFiber(currentFiber.root);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user