Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layout can hang indefinitely with Infinite width #718

Open
mattprecious opened this issue Feb 23, 2025 · 0 comments
Open

Layout can hang indefinitely with Infinite width #718

mattprecious opened this issue Feb 23, 2025 · 0 comments
Labels
bug Something isn't working mosaic/runtime PR welcome

Comments

@mattprecious
Copy link

mattprecious commented Feb 23, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mosaic/runtime PR welcome
Projects
None yet
Development

No branches or pull requests

2 participants