Skip to content

Recomposition Loop - VStack Layout #389

@tylerjonesio

Description

@tylerjonesio

I have been trying to track down some performance issues with my upcoming skip fuse app and stumbled upon an odd bug that arises with a very specific layout. I was able to distill the issue down into a simple isolated layout with skip lite and verified the recomposition loop with the layout inspector. In my app I've got either a grid or stack of items like the one below which just seems to compound the problem and leads to a very laggy interface.

When you include both an HStack with a Spacer alongside a shape (or other greedy member like GeometryReader) in a VStack, it seems to throw a fit and go into an infinite recomposition loop. I'm not familiar enough with compose or the internals of skip, but if it's similar enough to SwiftUI it seems like they could both be 'fighting' for defining the VStack's width. If you remove either the Spacer or the Rectangle, everything is fine. It's only an issue when both are included.

VStack(alignment: .leading) {
    Rectangle().fill(Color.gray).frame(height: 100.0)
    HStack {
        Text("Text")
        Spacer()
        Text("Sub")
            .font(.footnote)
    }
}
Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions