A small screen shows a list of tasks and remembers the selected filter between recreations. After device rotation and returning from the background, the behavior became unstable: some data disappears, and the selected state is not always restored.
ViewModel and SavedStateHandle.notifyDataSetChanged() call.Android API 35, Kotlin 2.0, kotlinx.coroutines 1.8.1, androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7, androidx.lifecycle:lifecycle-runtime-ktx:2.8.7, androidx.recyclerview:recyclerview:1.3.2.SavedStateHandle state must be thread-safe and not rely on background callbacks.Open.Android API 35, Kotlin 2.0, kotlinx.coroutines 1.8.1; androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7; androidx.lifecycle:lifecycle-runtime-ktx:2.8.7; androidx.recyclerview:recyclerview:1.3.2; execution mode: instrumented UI review; assumptions: single-activity app, process recreation simulated by system, main-thread UI updates only
Use line comments to explain the problem, its impact, the fix and how to test it.