Skip to content

Commit cf73bd7

Browse files
committed
fix: break up ContentView.body to fix type-checker timeout
The body property was a single ~360-line expression with 7 alerts, task/onReceive handlers, toolbar, and keyboard shortcuts chained together. Extracted into boardWithAlerts and boardWithHandlers computed properties so the Swift type-checker gets concrete type boundaries. Fixes #11
1 parent 1cb111b commit cf73bd7

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

Sources/KanbanCode/ContentView.swift

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,7 @@ struct ContentView: View {
357357
}
358358
}
359359

360-
var body: some View {
361-
NavigationStack {
360+
private var boardWithAlerts: some View {
362361
boardWithSheets
363362
.alert(
364363
"Remote Worktree",
@@ -500,6 +499,10 @@ struct ContentView: View {
500499
} message: {
501500
Text("This card has a worktree. Do you want to remove it?")
502501
}
502+
}
503+
504+
private var boardWithHandlers: some View {
505+
boardWithAlerts
503506
.task {
504507
// Show onboarding wizard on first launch
505508
if let settings = try? await settingsStore.read(), !settings.hasCompletedOnboarding {
@@ -555,9 +558,6 @@ struct ContentView: View {
555558
.onReceive(NotificationCenter.default.publisher(for: .kanbanCodeHookEvent)) { _ in
556559
Task {
557560
await orchestrator.processHookEvents()
558-
// Fast path: update activity states and columns immediately
559-
// without waiting for full reconciliation (which may be blocked
560-
// or take seconds due to discovery/PR fetching)
561561
await store.refreshActivity()
562562
systemTray.update()
563563
}
@@ -574,7 +574,6 @@ struct ContentView: View {
574574
}
575575
}
576576
.onReceive(NotificationCenter.default.publisher(for: .kanbanCodeQuitRequested)) { _ in
577-
// Build session list instantly from store state
578577
let sessions = store.state.cards.compactMap { card -> TmuxSession? in
579578
guard let tmux = card.link.tmuxLink else { return nil }
580579
return TmuxSession(name: tmux.sessionName, path: card.link.projectPath ?? "")
@@ -584,7 +583,6 @@ struct ContentView: View {
584583
} else {
585584
quitOwnedSessions = sessions
586585
showQuitConfirmation = true
587-
// Update alive status async — green dot = session exists in tmux
588586
Task.detached {
589587
let live = AppDelegate.listAllTmuxSessionsSync()
590588
let liveNames = Set(live.map(\.name))
@@ -608,6 +606,11 @@ struct ContentView: View {
608606
.onReceive(NotificationCenter.default.publisher(for: NSApplication.didResignActiveNotification)) { _ in
609607
store.appIsActive = false
610608
}
609+
}
610+
611+
var body: some View {
612+
NavigationStack {
613+
boardWithHandlers
611614
.toolbar {
612615
ToolbarItemGroup(placement: .navigation) {
613616
Button { showNewTask = true } label: {

0 commit comments

Comments
 (0)