What problem does it solve?
This Skill helps you correctly verify that Jetpack Compose state saved with rememberSaveable actually round-trips through a save/restore cycle, avoiding false-positive tests that pass even when restoration did nothing.
Core Features & Use Cases
- Validate rememberSaveable round-trips with StateRestorationTester by injecting a LocalSaveableStateRegistry, forcing a save โ dispose โ restore flow, and asserting restored values.
- Correctly separate the two compositions by capturing state from the first composition and then nulling the reference before calling emulateSavedInstanceStateRestore to ensure you re-read from the restored composition.
- Enforce restoration constraints including the 1 MB Bundle size limit and the requirement to use rememberSaveable (not plain remember) for persisted state.
- Avoid incorrect lifecycle assumptions by clarifying what is not exercised (no Activity recreation, no real configuration-change lifecycle, no plain remember persistence).
Quick Start
Use the testing-state-restoration skill to verify that your Compose UI state survives rememberSaveable restore by using StateRestorationTester(rule) with restorationTester.setContent, driving the state to a non-default value, setting the state reference to null, then calling emulateSavedInstanceStateRestore and asserting the restored values.