perf: reduce sidebar and list layout scans

Merged
TE
19d ago
+68-47

The merged animation pass exposed two adjacent steady-state scans that were independent of the native sidebar fix:

  • Bind the new-tab list-motion measurement effect to its list selector, row selector, and key signature so unrelated React renders do not force layout reads.
  • Use binary row lookup in the Rust sidebar patch reducer and Ratatui renderer, avoiding repeated linear scans and a full sort for sorted row updates.

Validation:

  • bunx biome check webviews/src/agent-session/acpmux/newtab/listMotion.ts
  • cargo fmt --manifest-path cmux-tui/bindings/rust-sidebar/Cargo.toml -- --check
  • The focused Rust test compile is blocked locally by a shared target built with rustc 1.99 while this lane has rustc 1.95 (E0514); no source diagnostic was observed.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Reduces steady-state layout scans in the sidebar and new-tab list, and adds opt-in animation variants while keeping all production defaults unchanged.

  • Binds the new-tab list-motion measurement effect to its list, row selector, and key signature so unrelated React renders no longer force layout reads; the key list is rebuilt from the signature to keep the effect's dependencies stable.
  • Binary row lookup replaces the Rust sidebar's repeated linear scans and full sort on sorted updates.
  • Sidebar scroll no longer refreshes hover across every window chrome target on each tick, and row marquees and hover layout defer their work while the list scrolls or applies bulk updates.
  • Workspace rows hide default allocation names like workspace-7 until a real title arrives, so a new workspace reads as a stable loading state; the default-name helper lives in the creator and is shared with the sidebar.
  • Workspace switches keep the sidebar list in place; the prototype no longer re-keys or animates the list root on every space change. A regression test asserts the list node and its styles stay stable across a switch.
  • Implementation extensions live under SidebarViewComponents and SidebarListViewComponents typealiases so checker work does not touch unrelated files.

Animation variants behind Debug Settings

  • Pane close and expand: crisp and softLanding presets reuse the existing geometry, and arriving split-pane content fades in.
  • Sidebar collapse: optional slideFade fades the panel while the width follows the same transition.
  • Tab loading: fade, fadeScale, and fadeSlide let the indicator enter and exit without changing the tab's measurements.
  • Workspace and agent titles crossfade on arrival.