diff --git a/packages/app/src/components/split-container.tsx b/packages/app/src/components/split-container.tsx index 7f627a8c72..be4d1f407f 100644 --- a/packages/app/src/components/split-container.tsx +++ b/packages/app/src/components/split-container.tsx @@ -872,19 +872,6 @@ function SplitGroupChild({ ); } -/** - * Sizes from a divider drag are kept per group id, apart from the layout tree. A group keeps its - * id when panes are added or removed, so the dragged sizes only apply while they still have one - * entry per child; otherwise the dividers past the end of the list could not move. - */ -function resolveGroupSizes( - layoutSizes: number[], - draggedSizes: number[] | undefined, - childCount: number, -): number[] { - return draggedSizes?.length === childCount ? draggedSizes : layoutSizes; -} - /** * Flex grow per child, renormalized so the visible ones always sum to 1. * @@ -981,11 +968,12 @@ function SplitNodeView({ groupId ? state.splitSizesByWorkspace[workspaceKey]?.[groupId] : undefined, ); const groupChildren = node.kind === "group" ? node.group.children : EMPTY_SPLIT_NODES; - const groupSizes = resolveGroupSizes( - node.kind === "group" ? node.group.sizes : EMPTY_SPLIT_SIZES, - storedGroupSizes, - groupChildren.length, - ); + // Dragged sizes live per group id, apart from the layout tree, and a group keeps its id when + // panes are added or removed. They only apply while they still have one entry per child; + // otherwise the dividers past the end of the list could not move. + const layoutGroupSizes = node.kind === "group" ? node.group.sizes : EMPTY_SPLIT_SIZES; + const groupSizes = + storedGroupSizes?.length === groupChildren.length ? storedGroupSizes : layoutGroupSizes; const visibleFlex = useMemo( () => resolveVisibleGroupFlex(groupChildren, groupSizes, maximizedPaneId), [groupChildren, groupSizes, maximizedPaneId],