testing-state-restoration

Validate rememberSaveable state persistence in Jetpack Compose components.

Updated Jul 20, 2026
One-click install
npx skills add https://github.com/trancee/MeshLink-template --skill testing-state-restoration-trancee
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-state-restoration
Source: https://github.com/trancee/MeshLink-template/tree/main/.agents/skills/android-testing-skills/compose/patterns/testing-state-restoration
Command: npx skills add https://github.com/trancee/MeshLink-template --skill testing-state-restoration-trancee

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill solves the common issue where Jetpack Compose state is lost during configuration changes or process death, providing a reliable way to test that your UI correctly saves and restores its state.

Core Features & Use Cases

  • State Restoration Verification: Uses StateRestorationTester to simulate save/restore cycles for rememberSaveable state.
  • Process Death Simulation: Validates that components correctly handle state serialization within the 1 MB Bundle limit.
  • Use Case: Use this when you need to ensure that complex UI components like LazyLists or custom input fields maintain their scroll position or user input after a system-initiated state restoration event.

Quick Start

Use the testing-state-restoration skill to verify that my custom Composable correctly saves and restores its internal state during a simulated process death cycle.

Frequently Asked Questions about testing-state-restoration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test that Jetpack Compose state survives process death without recreating an Activity?

Verify rememberSaveable state persistence by applying StateRestorationTester to simulate save and restore cycles for Compose components. This approach tests state restoration without relying on full Activity recreation.

What is the best way to verify rememberSaveable state restoration for complex Compose components like LazyLists?

The best way to verify rememberSaveable state restoration is using simulated save and restore cycles. This ensures complex UI components like LazyLists or custom input fields maintain their scroll position or user input after system-initiated restoration events.

Do I need the androidx.compose.ui:ui-test-junit4 library to test Compose state restoration?

Yes, testing Compose state restoration requires the androidx.compose.ui:ui-test-junit4 library. You must also adhere to specific state hoisting patterns within your unit testing scenarios to ensure accurate save and restore test results.

Does testing Compose state restoration validate serialization within the 1 MB Bundle limit?

Yes, process death simulation validates that your Compose components correctly handle state serialization within the 1 MB Bundle limit. This ensures your rememberSaveable state does not exceed Bundle constraints during configuration changes.

Why does my Jetpack Compose UI lose state during configuration changes?

Your Jetpack Compose UI loses state during configuration changes if rememberSaveable is not correctly implemented. Testing with StateRestorationTester identifies these issues by simulating save and restore cycles to verify state persistence.