diff --git a/apps/client/src/widgets/sidebar/RightPanelContainer.tsx b/apps/client/src/widgets/sidebar/RightPanelContainer.tsx index ef0af28f0..8d41929cc 100644 --- a/apps/client/src/widgets/sidebar/RightPanelContainer.tsx +++ b/apps/client/src/widgets/sidebar/RightPanelContainer.tsx @@ -51,6 +51,8 @@ export default function RightPanelContainer() { return () => splitInstance.destroy(); }, [ items ]); + const sizesBeforeCollapse = useRef(new WeakMap()); + return (
0 ? pos - 1 : pos + 1; if (sizes[itemToExpand] > COLLAPSED_SIZE) { sizes[itemToExpand] += sizeBeforeCollapse; } + } else { + const itemToExpand = pos > 0 ? pos - 1 : pos + 1; + const sizeBeforeCollapse = sizesBeforeCollapse.current.get(cardEl) ?? 50; + + if (sizes[itemToExpand] > COLLAPSED_SIZE) { + sizes[itemToExpand] -= sizeBeforeCollapse; + } + sizes[pos] = sizeBeforeCollapse; } console.log("Set sizes to ", sizes); splitInstance.setSizes(sizes);