Hello everyone, I am guessing there's something to the way remember works but I cannot make this work. My use case, load the profile from the backend and display it on the screen. Now when I first initialize the model for my composable I use dummy default values. Afterward, the backend fetches the profile and I want to render the new values. But it seems that even tho the composable gets recomposed, the remember values don't get updated (I guess that should happen lol). How can I go about this?
val model by component.models.subscribeAsState()
val profile = model.profile
val about = remember { mutableStateOf(TextFieldValue(profile.about)) }
val email = remember { mutableStateOf(TextFieldValue(profile.email)) }
Firstly the values for about and email are "" empty string but later on they get updated and the state updates. Is there a way to achieve this behaviour?
As I need this values later on for values in my textfields
TextField(
value = email.value,
onValueChange = { email.value = it },
label = { Text("Email") },
readOnly = !isEditing
)