From cbec58bfcedcf593898dadd4165d0588d64f757b Mon Sep 17 00:00:00 2001 From: Roman Pominov Date: Wed, 10 Aug 2022 15:11:27 +0300 Subject: [PATCH] remove unnecessary optimisation --- .../app/designer/shared/tree/tree-node.tsx | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/apps/designer/app/designer/shared/tree/tree-node.tsx b/apps/designer/app/designer/shared/tree/tree-node.tsx index 25082a8ffe..a48cad9f34 100644 --- a/apps/designer/app/designer/shared/tree/tree-node.tsx +++ b/apps/designer/app/designer/shared/tree/tree-node.tsx @@ -128,23 +128,27 @@ export const TreeNode = forwardRef( {label} - {isExpandable && (isExpanded || animate) && ( + {isExpandable && ( - {instance.children.flatMap((child) => - typeof child === "string" - ? [] - : [ - , - ] - )} + { + // CollapsibleContent automatically doesn't render children when collapsed. + // No need to worry about optimizing this. + instance.children.flatMap((child) => + typeof child === "string" + ? [] + : [ + , + ] + ) + } )}