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.

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.

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

1 participant