Skip to content

Conversation

@jcmosc
Copy link
Contributor

@jcmosc jcmosc commented Nov 25, 2025

In situations where the data passed to a ForEach is a _VariadicView.Children, as is the case for nested variadic views like so:

struct PassthroughUnaryViewRoot: _VariadicView.UnaryViewRoot {
    func body(children: _VariadicView.Children) -> some View {
        children
    }
}

_VariadicView.Tree(PassthroughUnaryViewRoot()) {
    ForEach(["A"], id: \.self) { element in
        Text(element)
    }
}

The subgraph for the inner for each item is released more than it is retained, causing the subgraph to invalidate and the view to render an empty list.

Copy link
Collaborator

@Kyle-Ye Kyle-Ye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@Kyle-Ye
Copy link
Collaborator

Kyle-Ye commented Nov 30, 2025

The ToggleUITests.onAndOffWithDefaultStyle is failing but I can reproduce it locally. It should pass after retry.

You can view detail and download failed image here https://github.com/OpenSwiftUIProject/OpenSwiftUI/actions/runs/19669127537?pr=653

@Kyle-Ye Kyle-Ye merged commit 2d3de54 into OpenSwiftUIProject:main Nov 30, 2025
7 of 9 checks passed
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.

2 participants