There seems to be a runtime crash with Compose WAS...
# compose-web
c
There seems to be a runtime crash with Compose WASM with
TextField
in Material2 (haven't tested Material3) in 1.4.1, on recomposition when changing themes and used in a
Surface
. Code snippet below should repro the crash in browser:
Copy code
var useDarkTheme by remember { mutableStateOf(false) }
var text by remember { mutableStateOf("Hello") }

MaterialTheme(
    colors = if (useDarkTheme) darkColors() else lightColors()
) {
    Surface {
        TextField(
            value = text,
            onValueChange = { text = it },
            label = { Text("Label") }
        )
        Button(onClick = { useDarkTheme = !useDarkTheme }) {
            Text("Toggle theme")
        }
    }
}
It works fine if you don't change colors on the fly, which is odd. Also this happens with
BasicTextField
so it's likely a deeper issue than the Material layer. Is this a known issue?
This is the crash I see in Chrome
m
I believe
toLanguageTag
was implemented in Compose 1.5, before that it threw the not implemented exception
o
Compose for Web 1.5.0 with k/wasm is not yet published, but WIP. toLanguageTag should be implemented there
👍 1