fixup, maybe

This commit is contained in:
Géry Debongnie
2021-12-05 09:35:55 +01:00
parent b3c6ec2b48
commit 09761ddd8e
3 changed files with 96 additions and 12 deletions
+8 -12
View File
@@ -201,19 +201,8 @@ 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 (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);
const prom = Promise.all(this.willUpdateProps.map((f) => f.call(component, props)));
@@ -221,8 +210,15 @@ export class ComponentNode<T extends typeof Component = typeof Component>
if (fiber !== this.fiber) {
return;
}
this.component.props = props;
component.props = props;
this._render(fiber);
const parentRoot = parentFiber.root;
if (this.willPatch.length) {
parentRoot.willPatch.push(fiber);
}
if (this.patched.length) {
parentRoot.patched.push(fiber);
}
}
/**