Bugfix: Why did split only work once per section in dock-layout, and...
Documentation for Sessions
🐛 Bugfix: Why did split only work once per section in dock-layout, and...
Date: 2026-03-08
Time: 17:33:40 UTC
Session: gspace1-192.3
Agent: angular
Confidence: 95%
Status: ✅ Documented
📋 Decision Context
Question:
Why did split only work once per section in dock-layout, and how to enable unlimited splits?
Task: Enable unlimited splits in dock-layout
🎯 Decision Made
Chosen:
Created splitActiveTab() in DockStateService that restructures the tree atomically in a single state update, bypassing the remove+insert+cleanup pattern that caused the bug
Options Considered:
- Fix movePanel to not cleanup during split operations
- Create new splitActiveTab method with atomic tree restructuring
- Add empty placeholder panel to prevent cleanup
💭 Reasoning
Root cause: movePanel() uses removeFromParent() + insertNode() + cleanupEmptyContainers(). When moving the last tab out of a group, the source tab group becomes empty → cleanupEmptyContainers collapses the split → net zero change. The fix creates splitActiveTab() that (1) removes the active tab from the tabs array, (2) creates a new tabs container for it, (3) creates a new split wrapping both, (4) rewires all parent references — all in one atomic signal update. No intermediate empty state means no cleanup collapse. Requires 2+ tabs to split (with 1 tab there's nothing to split from). Also added position parameter ('before'/'after') for Split Left/Up vs Split Right/Down.
📁 Files Involved
libs/libs-ui/dock-layout/src/lib/services/dock-state.service.tslibs/libs-ui/dock-layout/src/lib/services/dock-layout.service.tslibs/libs-ui/dock-layout/src/lib/components/dock-tabs/dock-tabs.component.ts
🔗 Related
- Decision ID:
dev_1772991220482_22hlhqo - Session: 192
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation