Hi! Is it normal to have ```val focusManager = Lo...
# compose
d
Hi! Is it normal to have
Copy code
val focusManager = LocalFocusManager.current
PrimaryButton("Hello", onClick = { focusManager.clearFocus() })
to cause
PrimaryButton
to always recompose? Removing
onClick
fixes recompositions (monitored by Android Studio)
a
I guess onClick lambda is not stable here because lambdas infer their stability from captured references and FocusManager is not stable. You probably can do something like
Copy code
val focusManager by rememberUpdatedState(LocalFocusManager.current)
to make it stable
d
The fact that
FocusManager
is not stable surprises me. Thanks!
a
It's my guess. It can be wrong
d
It seems, you are right:
Copy code
@JvmDefaultWithCompatibility
interface FocusManager {