perf(cmux-tui): avoid cloning projection specs per frame

Merged
LA
1mo ago
+35-3

Summary

  • extract the SidebarResourceKind leaf before mutable projection rendering
  • preserve empty-projection and missing-view behavior
  • add a behavior test for the configured leaf label

This replaces https://github.com/manaflow-ai/cmux/pull/11485 under the matching opener and commit-author identity. The source head is unchanged. The scalar extraction removes per-frame SidebarViewSpec heap copies without changing row order, selection, hit targets, or labels.

Verification


Summary by cubic

Avoids cloning the projection spec on every frame, cutting per-frame heap allocations in the sidebar without changing row order, selection, hit targets, or labels.

  • Derives the empty-projection resource label from a borrowed view spec instead of a cloned one.
  • Adds a regression test that ensures an empty projection uses its configured leaf resource label.

Summary by CodeRabbit

  • Bug Fixes

    • Empty sidebar views now display the correct message for the configured resource, such as “no tabs,” instead of incorrectly referring to workspaces.
  • Tests

    • Added coverage to verify empty-state messaging when a sidebar view is configured with multiple levels.