Problem
PaneGridView.swift wraps all nodes in AnyView to break the recursive opaque return type:
private func rootView(_ node: PaneSplitNode) -> AnyView { ... }
private func nodeView(_ node: PaneSplitNode) -> AnyView { ... }
AnyView defeats SwiftUI's structural diffing — it cannot efficiently compare old and new view trees, leading to full view hierarchy destruction/recreation on any change. For a grid of terminals, this means split ratio changes or focus changes can cause terminal views to be needlessly torn down and rebuilt.
Impact
- Terminal views may be destroyed and recreated unnecessarily when focus changes or splits are adjusted
- Animation transitions may not work correctly
- SwiftUI's identity tracking is broken for the entire grid subtree
Suggested approach
Options to explore:
- Use
@ViewBuilder with explicit conditional logic and stable view identities
- Use
Group with stable .id() values at the leaf level
- Only type-erase at the leaf
PaneCellView level, not the entire tree
- Consider a custom layout container that doesn't require type erasure
This is a complex change since the recursive tree structure genuinely needs type erasure somewhere — the goal is minimizing its scope.
Files
apps/purepoint-macos/purepoint-macos/Views/PaneGrid/PaneGridView.swift
Problem
PaneGridView.swiftwraps all nodes inAnyViewto break the recursive opaque return type:AnyViewdefeats SwiftUI's structural diffing — it cannot efficiently compare old and new view trees, leading to full view hierarchy destruction/recreation on any change. For a grid of terminals, this means split ratio changes or focus changes can cause terminal views to be needlessly torn down and rebuilt.Impact
Suggested approach
Options to explore:
@ViewBuilderwith explicit conditional logic and stable view identitiesGroupwith stable.id()values at the leaf levelPaneCellViewlevel, not the entire treeThis is a complex change since the recursive tree structure genuinely needs type erasure somewhere — the goal is minimizing its scope.
Files
apps/purepoint-macos/purepoint-macos/Views/PaneGrid/PaneGridView.swift