mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] component: render in delayed willUpdateProps
Have a child component on which a render is triggered. This component delays its willUpdateProps and makes a rendering during the willUpdateProps Before this commit, renderings of the child were inconsistent across its parent's renderings. After this commit, it works as expected.
This commit is contained in:
committed by
Géry Debongnie
parent
b20462ada6
commit
b3c6ec2b48
@@ -201,13 +201,18 @@ export class ComponentNode<T extends typeof Component = typeof Component>
|
||||
|
||||
async updateAndRender(props: any, parentFiber: Fiber) {
|
||||
// update
|
||||
const root = this.fiber && this.fiber.root;
|
||||
const fiber = makeChildFiber(this, parentFiber);
|
||||
const parentRoot = parentFiber.root;
|
||||
const rootChanged = root !== parentRoot;
|
||||
this.fiber = fiber;
|
||||
if (this.willPatch.length) {
|
||||
parentFiber.root.willPatch.push(fiber);
|
||||
}
|
||||
if (this.patched.length) {
|
||||
parentFiber.root.patched.push(fiber);
|
||||
if (rootChanged) {
|
||||
if (this.willPatch.length) {
|
||||
parentRoot.willPatch.push(fiber);
|
||||
}
|
||||
if (this.patched.length) {
|
||||
parentRoot.patched.push(fiber);
|
||||
}
|
||||
}
|
||||
const component = this.component;
|
||||
applyDefaultProps(props, component.constructor as any);
|
||||
|
||||
Reference in New Issue
Block a user