TextField race condition? onValueChange is adding initial value multiple times while typing (randomly) - Jetpack Compose

Viewed 403

I have the following code in my activity:

        setContent {
            var testingText by remember { mutableStateOf("InitialValue") }
            TextField(
                value = testingText,
                onValueChange = { testingText = it },
                label = { Text("Testing") },
                modifier = Modifier.fillMaxWidth(),
            )
        }

While running on an emulator, typing anything at the end of the text field, around 1 out of ~5 times - the text that I type ends up getting "InitialValue" added to whatever I type. See the below screenshot:

text field

I believe this trivial example is following the official docs. Wondering what is causing this race condition, could it be a bug? Am I doing something wrong? Maybe emulator/IME issue?

On 1.0.1 of compose.

0 Answers
Related