From 6f86beeaf399f068060eaa2cbf41013b1fe09914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Sat, 25 Jun 2022 09:27:35 +0200 Subject: [PATCH] [REF] app: slightly simplify the create component path --- src/runtime/app.ts | 6 +----- src/runtime/fibers.ts | 1 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/runtime/app.ts b/src/runtime/app.ts index c2974abf..c8412168 100644 --- a/src/runtime/app.ts +++ b/src/runtime/app.ts @@ -3,7 +3,6 @@ import { ComponentNode } from "./component_node"; import { nodeErrorHandlers } from "./error_handling"; import { Fiber, MountOptions } from "./fibers"; import { Scheduler } from "./scheduler"; -import { STATUS } from "./status"; import { validateProps } from "./template_helpers"; import { TemplateSet, TemplateSetConfig } from "./template_set"; import { validateTarget } from "./utils"; @@ -141,10 +140,7 @@ export class App< return (props: P, key: string, ctx: ComponentNode, parent: any, C: any) => { let children = ctx.children; let node: any = children[key]; - if ( - node && - (node.status === STATUS.DESTROYED || (isDynamic && node.component.constructor !== C)) - ) { + if (isDynamic && node && node.component.constructor !== C) { node = undefined; } const parentFiber = ctx.fiber!; diff --git a/src/runtime/fibers.ts b/src/runtime/fibers.ts index 98e1f33c..755f0911 100644 --- a/src/runtime/fibers.ts +++ b/src/runtime/fibers.ts @@ -56,6 +56,7 @@ function cancelFibers(fibers: Fiber[]): number { fiber.render = throwOnRender; if (node.status === STATUS.NEW) { node.destroy(); + delete node.parent!.children[node.parentKey!]; } node.fiber = null; if (fiber.bdom) {