Skip to content

Layout can hang indefinitely with Infinite width #718

Open
@mattprecious

Description

@mattprecious

I thought the minimal repro was going to simply be 'pass Infinity to MeasureScope.layout()', but it seems to be more complicated than that.

@Test
fun infinity() = runTest {
  runMosaicTest {
    setContentAndSnapshot {
      Layout(content = { Text("Hello") }) { measurables, constraints ->
        val placeables = measurables.map { it.measure(constraints) }
        layout(constraints.maxWidth, placeables.sumOf { it.height }) {
          placeables.forEach { it.place(0, 0) }
        }
      }
    }
  }
}

Seems like there needs to be a Text in the content, and it needs to be measured and placed. The height also needs to be non-Infinity.

I don't think that this should necessarily be supported, but throwing an exception would be better than hanging.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions