[REF] component: small cleanup

This commit makes it simpler to understand the way fibers are assigned
to nodes.
This commit is contained in:
Géry Debongnie
2021-11-25 11:13:48 +01:00
committed by Aaron Bohy
parent e6e6c31632
commit 05a57d6da5
2 changed files with 3 additions and 1 deletions
+3
View File
@@ -121,6 +121,7 @@ export class ComponentNode<T extends typeof Component = typeof Component>
}
async initiateRender(fiber: Fiber | MountFiber) {
this.fiber = fiber;
if (this.mounted.length) {
fiber.root.mounted.push(fiber);
}
@@ -146,6 +147,7 @@ export class ComponentNode<T extends typeof Component = typeof Component>
return;
}
const fiber = makeRootFiber(this);
this.fiber = fiber;
this.app.scheduler.addFiber(fiber);
await Promise.resolve();
if (this.status === STATUS.DESTROYED) {
@@ -211,6 +213,7 @@ export class ComponentNode<T extends typeof Component = typeof Component>
async updateAndRender(props: any, parentFiber: Fiber) {
// update
const fiber = makeChildFiber(this, parentFiber);
this.fiber = fiber;
if (this.willPatch.length) {
parentFiber.root.willPatch.push(fiber);
}