fix(ui): prevent LazyVStack layout hang with 700+ cards#70
Open
sergioestebance wants to merge 1 commit into
Open
fix(ui): prevent LazyVStack layout hang with 700+ cards#70sergioestebance wants to merge 1 commit into
sergioestebance wants to merge 1 commit into
Conversation
The sidebar ListBoardView used LazyVStack with pinnedViews: [.sectionHeaders], but each section wrapped its cards in an inner LazyVStack. The outer container needed to measure each section to position pinned headers, which required materializing the inner LazyVStack — forcing all ~700 card views to be laid out on every reconciliation cycle. Thread samples confirmed 100% main thread time spent in LazySubviewPlacements.placeSubviews → ForEachList.applyNodes. Two changes: - Remove pinnedViews from the outer LazyVStack so sections are lazily evaluated without full measurement - Replace the inner LazyVStack with VStack so the outer container can size sections via their direct children Also move ChannelShareController drain loops from Task.detached to DispatchQueue.global to avoid blocking the cooperative thread pool with synchronous FileHandle.availableData reads.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LazyVStack(pinnedViews: [.sectionHeaders])in the sidebarListBoardView. The outer container needed to measure each section to position pinned headers, which forced materializing all ~700 card views on every reconciliation cycle (3s), permanently blocking the main thread.LazyVStackin section bodies, replacing withVStackso the outer lazy container can size sections via direct children.ChannelShareControllerdrain loops fromTask.detachedtoDispatchQueue.globalto avoid blocking the cooperative thread pool with synchronousFileHandle.availableDatareads.Evidence
Thread samples (
~/.kanban-code/logs/main-thread-samples/) showed 100% of samples inLazySubviewPlacements.placeSubviews→ForEachList.applyNodeswith deeply nested per-item modifier chains. Watchdog log confirmed continuousHANG: main thread blocked for >500msevery 10 seconds for 2+ hours.Test plan
swift test— all 755 tests pass