Skip to content

Store view builder closures lazily to prevent empty alert content - #372

Open
andre-moneyforward wants to merge 1 commit into
pointfreeco:mainfrom
andre-moneyforward:fix-alert-modifier-empty-content
Open

andre-moneyforward wants to merge 1 commit into
pointfreeco:mainfrom
andre-moneyforward:fix-alert-modifier-empty-content

Conversation

@andre-moneyforward

@andre-moneyforward andre-moneyforward commented Aug 16, 2026

Copy link
Copy Markdown

Problem

AlertModifier was eagerly evaluating and storing @ViewBuilder view outputs (_actions, _message) inside init(). Because the modifier is initially constructed when item is nil, the view builders evaluated to nil and discarded the building blocks. When item was subsequently updated, the alert presented without actions or messages.
Fixes: #371

Solution

  • Refactored AlertModifier to store the view builder closures ((Item) -> View) as struct properties rather than storing their evaluated view results.
  • Deferred execution of the closures to body(content:), ensuring views are constructed lazily using the live, non-nil Item instance at presentation time.

@andre-moneyforward
andre-moneyforward force-pushed the fix-alert-modifier-empty-content branch from 40f980a to 2a1384a Compare September 1, 2026 01:41
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.

AlertState renders empty content inside fullScreenCover (swift-navigation >= 2.9.1)

1 participant