cmux-next sidebar: a click moves no row, and a move changes the order once
Merged
TE
16d ago+210+210+012345678901234567890123456789-49-49-01234567890123456789
In progress: the test commit is pushed, and the fix is next.
Leo (2026-10-20): moving between sidebar rows or clicking them causes "unnecessary multi-sidebar walks": the rows jump, then settle. The rule:
- A click or a selection reorders nothing and moves no row.
- A move changes the order exactly once, to where it lands.
- Manual order is the truth. Sorting by attention belongs only in the Priority view (#22907).
Causes found (planned fixes)
- Collapsed groups: a collapsed group shows its selected member as its one row. Clicking any row outside the group removed that row, so every row below it moved up, including the one just clicked. The fix keeps that member shown until the group is folded or opened again.
- Rows that change in the same moment as a click: a selection change and a row change arriving together reloaded the list at once, with no hold under the pointer. So a pending reorder nobody asked for showed up on the click. The fix draws only the selection and holds the row change, as for any change nobody asked for.
- Switching to a workspace: switching ran a full pass over every row whenever the target's content wasn't parked, even if its row was already listed. The fix runs that pass only for a workspace that isn't listed yet.
- Moves on the daemon path: a move on the daemon path (no personal order) had no pending edit, so each
move-workspaceecho showed an intermediate order. The fix adds the same pending edit the personal path uses.
Test
Tests/CmuxNextAppTests/SidebarClickMovesNoRowTests.swift:
- Selecting rows outside a collapsed group keeps every row's top.
- A click doesn't show a reorder that arrived in the same moment.
- A move through
SidebarRowsshows exactly two orders, the start and the final one, across the partial echo, the final echo and the settle.
Commit 89cfe6ffe35 adds the tests alone; the first two should fail on base.
Observed / Not run
- Observed:
prepush-gate.pyreports no new violations. - Not run yet: the Swift compile and the tests (CI and the fleet).
Changelog
- Fixed: Clicking a sidebar row no longer moves other rows, and a move lands in one step.
Agent session: cosmic-gray
🤖 Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes sidebar rows jumping then settling on clicks and moves: a click or selection now moves no row, and a move changes the order exactly once.
- Collapsed groups keep drawing the member the selection leaves (
revealedMembers, tracked per group) until the group folds or opens, even across a later full layout, so clicking elsewhere removes no row. - A selection arriving with a row change nobody asked for draws the selection only; rows wait under the pointer like any other such change.
- Switching to a workspace whose row is already listed skips the full walk of every row.
- A reorder on the daemon path shows through a pending edit, so no command echo shows an intermediate order.
- Adds tests in
SidebarClickMovesNoRowTests.swiftcovering the collapse-group click, a full layout after it, a refold forgetting the member, a click landing with a waiting reorder, and a move drawing only the start and final orders.