mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[REF] component: small cleanup
This commit makes it simpler to understand the way fibers are assigned to nodes.
This commit is contained in:
committed by
Aaron Bohy
parent
e6e6c31632
commit
05a57d6da5
@@ -121,6 +121,7 @@ export class ComponentNode<T extends typeof Component = typeof Component>
|
|||||||
}
|
}
|
||||||
|
|
||||||
async initiateRender(fiber: Fiber | MountFiber) {
|
async initiateRender(fiber: Fiber | MountFiber) {
|
||||||
|
this.fiber = fiber;
|
||||||
if (this.mounted.length) {
|
if (this.mounted.length) {
|
||||||
fiber.root.mounted.push(fiber);
|
fiber.root.mounted.push(fiber);
|
||||||
}
|
}
|
||||||
@@ -146,6 +147,7 @@ export class ComponentNode<T extends typeof Component = typeof Component>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const fiber = makeRootFiber(this);
|
const fiber = makeRootFiber(this);
|
||||||
|
this.fiber = fiber;
|
||||||
this.app.scheduler.addFiber(fiber);
|
this.app.scheduler.addFiber(fiber);
|
||||||
await Promise.resolve();
|
await Promise.resolve();
|
||||||
if (this.status === STATUS.DESTROYED) {
|
if (this.status === STATUS.DESTROYED) {
|
||||||
@@ -211,6 +213,7 @@ export class ComponentNode<T extends typeof Component = typeof Component>
|
|||||||
async updateAndRender(props: any, parentFiber: Fiber) {
|
async updateAndRender(props: any, parentFiber: Fiber) {
|
||||||
// update
|
// update
|
||||||
const fiber = makeChildFiber(this, parentFiber);
|
const fiber = makeChildFiber(this, parentFiber);
|
||||||
|
this.fiber = fiber;
|
||||||
if (this.willPatch.length) {
|
if (this.willPatch.length) {
|
||||||
parentFiber.root.willPatch.push(fiber);
|
parentFiber.root.willPatch.push(fiber);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ export class Fiber {
|
|||||||
|
|
||||||
constructor(node: ComponentNode, parent: Fiber | null) {
|
constructor(node: ComponentNode, parent: Fiber | null) {
|
||||||
this.node = node;
|
this.node = node;
|
||||||
node.fiber = this;
|
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
if (parent) {
|
if (parent) {
|
||||||
const root = parent.root;
|
const root = parent.root;
|
||||||
|
|||||||
Reference in New Issue
Block a user