```@Composable fun ReviewTextField( <-------------...
# compose
u
Copy code
@Composable
fun ReviewTextField( <-------------------------------
    fieldName: String,
    value: String,
    onValueChange: (String) -> Unit,
) {
    Column(
        modifier = Modifier.fillMaxWidth(),
        verticalArrangement = Arrangement.spacedBy(8.dp)
    ) {
        ...

        OutlinedTextField( <-------------------------
            modifier = Modifier
                .fillMaxWidth(),
            value = value,
            placeholder = { Text(text = fieldName, fontWeight = FontWeight.Normal) },
            onValueChange = onValueChange,
            textStyle = MaterialTheme.typography.body1Strong,
            singleLine = true,
            ...
        )
    }
}
Is it normal for
ReviewTextField
to get recomposed everytime, even if the input don't change if it contains a
OutlinedTextField
? If I turn the text field into a
Text
then the parent doesn't recompose As if
TextField
was causing it to be unstable Wtf? // If I remove the
onValueChange
lambda, then it stops recomposing even with
OutlinedTextField
there .. is lambda making the whole thing non skippable?
a
Strong skipping probably tries to fix this
u
so am I not imagining thing? btw why would a lambda be unstable?
u
is it because of the anonymous class legacy crap? i.e. different instances etc?
a
“All lambdas in composable functions are automatically remembered. This means you will no longer have to wrap lambdas in remember to ensure a composable that uses a lambda, skips.”
So probably to fix above is to wrap the outer most lambda in a remember block
u
works .. great!
a
“the Compose compiler will only wrap lambdas in composable functions that only capture stable values in a remember function”
u
but is a bit perplexing would a lambda of primitive types be unstable I get that for foreign custom types you cant tell
a
The outer most lambda - you might be capturing an unstable object?
Where review text field is called from
u
well its telescoped all the way to the screen, and there its
onValueChanges = viewModel::valueChanged
and yea view model is obviously unstable
so thats fucking why omg ! thanks!
a
No problem! lol
u
never occured to me to @Stable viewmodels
oh neat in strong skipping mode you dont have to @Immutable/Stable things at all
a
Yeah it’s a fundamental change but a great one. The react compiler is doing a similar thing. https://blog.stackademic.com/react-19-how-react-compiler-will-take-your-code-to-the-next-level-8a89702d8860