testing-state-restoration

Community

Prove rememberSaveable survives restore.

Authorskydoves
Version1.0.0
Installs0

System Documentation

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.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: testing-state-restoration
Download link: https://github.com/skydoves/android-testing-skills/archive/main.zip#testing-state-restoration

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.