Skip to content

Fix Clean Up window freezing when expanding sections - #893

Open
oguzhanvarsak wants to merge 1 commit into
XcodesOrg:mainfrom
oguzhanvarsak:fix/cleanup-window-hang
Open

oguzhanvarsak wants to merge 1 commit into
XcodesOrg:mainfrom
oguzhanvarsak:fix/cleanup-window-hang

Conversation

@oguzhanvarsak

Copy link
Copy Markdown

Fixes #892

Problem

After expanding a few sections in the Clean Up window and scrolling (or toggling items), the window freezes and the main thread stays at ~100% CPU. The cleanup list nests lazy stacks (a ScrollView > LazyVStack of section cards, each with another LazyVStack of rows), and SwiftUI gets stuck re-laying them out.

Change

Use VStack instead of LazyVStack for the section list in CleanupWindow and for the rows in CleanupCategorySection and CleanupRuntimeSection. Making only the inner stacks eager wasn't enough; the outer one has to be eager too. Collapsed sections still build no rows.

Testing

  • Reproduced the freeze on main (Debug and Release) by expanding sections such as Derived Data and Simulator devices and scrolling. With this change it no longer reproduces, and a sample right after scrolling and toggling shows the main thread idle.
  • xcodebuild test -scheme Xcodes: 126 tests, 0 failures (3 skipped).

Known limitation

Very large sections (~1,000 entries) no longer freeze but still scroll slowly; that needs separate work. Details and the other approach I tried are in #892 (comment).

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.
@oguzhanvarsak
oguzhanvarsak marked this pull request as ready for review November 16, 2026 10:43

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clean Up window freezes after expanding sections and scrolling

1 participant