From ce51fa79ba6330b36cca8ffa5403d285bf5a68f8 Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Fri, 24 Apr 2026 02:27:41 +0700 Subject: [PATCH] chore(lint): extract SplitGroupChild to memoize inline styles --- .../app/src/components/split-container.tsx | 87 ++++++++++++------- 1 file changed, 57 insertions(+), 30 deletions(-) diff --git a/packages/app/src/components/split-container.tsx b/packages/app/src/components/split-container.tsx index 919e95748..412774450 100644 --- a/packages/app/src/components/split-container.tsx +++ b/packages/app/src/components/split-container.tsx @@ -182,8 +182,13 @@ const MountedTabSlot = memo(function MountedTabSlot({ [buildPaneContentModel, paneId, tabDescriptor], ); + const wrapperStyle = useMemo( + () => ({ display: (isVisible ? "flex" : "none") as "flex" | "none", flex: 1 }), + [isVisible], + ); + return ( - + t.tabId === tabId); - if (!tab) { + const descriptor = useMemo( + () => + tab + ? { + key: tab.tabId, + tabId: tab.tabId, + kind: tab.target.kind, + target: tab.target, + } + : null, + [tab], + ); + if (!descriptor) { return null; } - const descriptor: WorkspaceTabDescriptor = { - key: tab.tabId, - tabId: tab.tabId, - kind: tab.target.kind, - target: tab.target, - }; return ( [ + styles.dragOverlayChip, + { + backgroundColor: theme.colors.surface1, + borderColor: theme.colors.borderAccent, + }, + ], + [theme.colors.surface1, theme.colors.borderAccent], + ); + const chipLabelStyle = useMemo( + () => [styles.dragOverlayLabel, { color: theme.colors.foreground }], + [theme.colors.foreground], + ); + return ( + - + {label} @@ -630,6 +645,11 @@ function DragOverlayTabChipInner({ ); } +function SplitGroupChild({ flex, children }: { flex: number; children: ReactNode }) { + const childStyle = useMemo(() => [styles.groupChild, { flex }], [flex]); + return {children}; +} + function SplitNodeView({ node, workspaceKey, @@ -707,16 +727,19 @@ function SplitNodeView({ (state) => state.splitSizesByWorkspace[workspaceKey]?.[node.group.id], ) ?? node.group.sizes; + const groupStyle = useMemo( + () => [ + styles.group, + node.group.direction === "horizontal" ? styles.groupHorizontal : styles.groupVertical, + ], + [node.group.direction], + ); + return ( - + {node.group.children.map((child, index) => ( - + - + {index < node.group.children.length - 1 ? ( onSplitPaneEmpty({ targetPaneId: paneId, position: "bottom" }), [onSplitPaneEmpty, paneId], ); + const paneTabsStyle = useMemo( + () => [styles.paneTabs, { paddingLeft: padding.left, paddingRight: padding.right }], + [padding.left, padding.right], + ); return ( - +