Skip to content

Add NSTableView/NSOutlineView cell reuse to AppKit views #63

@2witstudios

Description

@2witstudios

Problem

Two AppKit view controllers create brand new cell views on every reload instead of using the standard makeView(withIdentifier:owner:) cell reuse pattern:

SidebarOutlineViewController (710 lines)

  • makeProjectCell, makeWorktreeCell, makeAgentCell (lines 272-397) create fresh NSTableCellView + NSStackView instances every time outlineView(_:viewFor:item:) is called
  • rebuildNodes is called from updateNSViewController which fires on every SwiftUI state change, creating allocation pressure

CommandPaletteViewController (~640 lines)

  • tableView(_:viewFor:row:) (lines 667-717) creates new cells every call
  • filterVariants calls reloadData() on every keystroke, so typing creates new views for every filtered result on every character

Impact

Without cell reuse:

  • Scrolling or frequent reloads allocate and discard many views
  • GC pressure increases with more items
  • Performance degrades with larger lists

Suggested approach

  1. Register cell identifiers for each cell type
  2. Use makeView(withIdentifier:owner:) to reuse cells
  3. Configure the reused cell's content instead of rebuilding the view hierarchy

Files

  • apps/purepoint-macos/purepoint-macos/Views/Sidebar/SidebarOutlineViewController.swift
  • apps/purepoint-macos/purepoint-macos/Views/CommandPalette/CommandPalettePanel.swift

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions