mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-23 09:42:53 +00:00
Splitting a pane right from the default layout tore down the existing pane and rebuilt it, losing the composer, terminal, and scroll state in it. Both split reducers derived the parent group from `parentPath.length`, but `targetPath.slice(0, -1)` is empty for two different situations: the pane is the whole tree, and the pane is a direct child of the root group. The second case was read as parentless, so the same-direction fast path never ran at root level and every split wrapped the pane in a fresh group. That reparents the pane, and the renderer reconciles panes positionally, so React unmounted the subtree. The workspace already starts as a horizontal group holding the main pane and the hidden explorer pane — the group was there all along, ready to take another child. `findParentGroup` now asks `targetPath`, so a same-direction split appends a sibling into the group that is already running in that axis. Perpendicular splits still nest, because changing axis needs a group. The old test asserted the nesting as intended behaviour, which is how this survived. It now asserts flat insertion, alongside the invariant that matters: a same-direction split never changes an existing pane's render path. Node id sequences shifted in three tests because the first split no longer spends a group id, and four user splits now fit inside the depth cap where the fourth used to be refused.