fix(settings): crash opening Position radio-config screen#5862
Conversation
Opening the Position radio-config screen crashed instantly with
IllegalArgumentException: a `rememberSaveable { mutableStateOf(currentPosition) }`
had no stateSaver, so it fell back to the default Bundle saver. `Position` is a
plain core.model data class (not Parcelable/Bundle-storable), so the saveable
registration threw on the main thread as soon as the screen composed.
Provide a listSaver over Position's primitive fields and pass it as stateSaver.
All eight fields are round-tripped so the `locationInput != currentPosition`
dirty check stays correct.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
📄 Docs staleness check — advisoryThis PR modifies user-facing UI source files but does not update any page under
Changed source files: What to check:
New page checklist (if adding a new doc page):
If this PR does not require a doc update (e.g., internal refactor, bug fix, test change), add the
|
🖼️ Preview staleness check — advisoryThis PR modifies UI composables but does not update any
Changed UI files: What to check:
Adding previews checklist:
If this PR does not require preview updates (e.g., logic-only change, non-visual refactor), add the |
Why
Tapping Location in radio config crashed the app instantly (reproduced on a Pixel 9 Pro via logcat):
PositionConfigScreenusedrememberSaveable { mutableStateOf(currentPosition) }with nostateSaver.Positionis a plaincore.modeldata class (notParcelable/Bundle-storable), sorememberSaveablefell back to the default Bundle saver and threw on the main thread the moment the screen composed — the crash happened on entry, not on any interaction.What changed
listSaveroverPosition's primitive fields and passed it asstateSaverto therememberSaveable. All fields areDouble/Int, so the saver is KMP/Bundle-safe.additionalDirtyCheck { locationInput != currentPosition }equality comparison stays correct.Testing Performed
./gradlew :feature:settings:assemble spotlessCheck detekt— all pass.🤖 Generated with Claude Code