ViewModel
An Android Jetpack architecture component used to retain and manage UI-related state across configuration changes. It commonly serves as an intermediate layer for state orchestration and composition.
Timeline (last 90 days)
When hoisting TextFieldState to a ViewModel, it should be a direct property of the ViewModel rather than being placed in the UI state of an immutable data class, otherwise the copy method will create a new instance and cause loss of selection, cursor, and history.
A ViewModel has no rememberSaveable, so a Saver must be configured manually for TextFieldState to restore state after process death.
All Facts (2)
When hoisting TextFieldState to a ViewModel, it should be a direct property of the ViewModel rather than being placed in the UI state of an immutable data class, otherwise the copy method will create a new instance and cause loss of selection, cursor, and history.
50%UnverifiedA ViewModel has no rememberSaveable, so a Saver must be configured manually for TextFieldState to restore state after process death.
50%