From e7ead7977c2f9e9c6f499f5c1043b19b2748090d Mon Sep 17 00:00:00 2001 From: Oguzhan Varsak Date: Sun, 15 Nov 2026 15:53:48 +0100 Subject: [PATCH] Fix Clean Up window freezing when expanding sections The cleanup list nested LazyVStacks: an outer one in the window's ScrollView whose cells are section cards, and an inner one per expanded card. After expanding a few sections, scrolling or toggling items left the main thread stuck in SwiftUI layout (repeated LazyVStack size estimates and item phase updates, amplified by hover updates), so the window stopped responding. Use eager VStacks instead. Collapsed sections still build no rows, and typical sections hold tens of rows. Very large folders (~1,000 entries) no longer freeze but still scroll slowly; that needs separate work. --- Xcodes/Frontend/Cleanup/CleanupCategorySection.swift | 2 +- Xcodes/Frontend/Cleanup/CleanupRuntimeSection.swift | 2 +- Xcodes/Frontend/Cleanup/CleanupWindow.swift | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Xcodes/Frontend/Cleanup/CleanupCategorySection.swift b/Xcodes/Frontend/Cleanup/CleanupCategorySection.swift index c30f9009..e704e511 100644 --- a/Xcodes/Frontend/Cleanup/CleanupCategorySection.swift +++ b/Xcodes/Frontend/Cleanup/CleanupCategorySection.swift @@ -77,7 +77,7 @@ struct CleanupCategorySection: View { } if expanded { Divider() - LazyVStack(alignment: .leading, spacing: 0) { + VStack(alignment: .leading, spacing: 0) { if let explanation { Text(explanation).foregroundStyle(.secondary).padding(.vertical, 8) } diff --git a/Xcodes/Frontend/Cleanup/CleanupRuntimeSection.swift b/Xcodes/Frontend/Cleanup/CleanupRuntimeSection.swift index f2c8282d..0c18105a 100644 --- a/Xcodes/Frontend/Cleanup/CleanupRuntimeSection.swift +++ b/Xcodes/Frontend/Cleanup/CleanupRuntimeSection.swift @@ -43,7 +43,7 @@ struct CleanupRuntimeSection: View { .onHover { hovering = $0 } if expanded { Divider() - LazyVStack(alignment: .leading, spacing: 0) { + VStack(alignment: .leading, spacing: 0) { ForEach(runtimes) { runtime in CleanupRuntimeItemRow(model: model, runtime: runtime) } } .padding(.horizontal, 12).padding(.leading, 28) diff --git a/Xcodes/Frontend/Cleanup/CleanupWindow.swift b/Xcodes/Frontend/Cleanup/CleanupWindow.swift index ab58ebe4..4c56c8f3 100644 --- a/Xcodes/Frontend/Cleanup/CleanupWindow.swift +++ b/Xcodes/Frontend/Cleanup/CleanupWindow.swift @@ -86,7 +86,9 @@ struct CleanupWindow: View { CleanupProgressView(progress: progress, stop: model.stopCleanupAfterCurrentItem) } ScrollView { - LazyVStack(alignment: .leading, spacing: 14) { + // Eager on purpose: as a LazyVStack, the tall, variable-height section cards kept invalidating its + // size estimates and item phases, leaving the main thread stuck in a layout loop. + VStack(alignment: .leading, spacing: 14) { if sections.isEmpty && !model.isScanning { Text(model.selectedOperatingSystem == nil ? "No cleanup findings. Add a folder to scan." : "No items match this OS version.").foregroundStyle(.secondary) }