preserving-state-across-reloads

Community

Preserve state across HotSwan reloads

Authorskydoves
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Use this skill to keep Jetpack Compose state alive across HotSwan hot reloads by understanding the three escalating tiers Compose HotSwan uses (tier 1 targeted recomposition, tier 2 composition reset, tier 3 Activity.recreate) and choosing edits and state holders that stay inside tier 1 where scroll position, lazy items, dialog state, and per-composable remember values all survive. Explains which edits force escalation, which state holders survive each tier, and how to hoist transient UI state when the iteration loop must escalate.

Core Features & Use Cases

When a hot reload escalates, this skill helps you diagnose exactly which state holders survive at each tier, how to prevent loss by preferring rememberSaveable and hoisting UI state into a ViewModel, and how to avoid root theme or CompositionLocal mutations that escalate tiers. It also covers patterns for preserving scroll position with rememberLazyListState and for keeping transient UI state across restarts.

  • Understand the three-tier model of HotSwan (tier 1 targeted recomposition, tier 2 composition reset, tier 3 Activity.recreate) and how they affect state retention.
  • Learn practical strategies to keep scroll position, dialog state, and per-composable remember values across reloads, including migrating local remember to rememberSaveable and hoisting to a ViewModel.
  • Use scenarios like scrolling, dialogs, tab selections, and lazy lists to decide when to hoist state and how to structure components for maximum tier-1 retention.

Quick Start

Identify edits that stay within tier 1 and hoist transient UI state into a ViewModel to maintain continuity during fast hot reload iterations.

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: preserving-state-across-reloads
Download link: https://github.com/skydoves/compose-performance-skills/archive/main.zip#preserving-state-across-reloads

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 510,000+ vetted skills library on demand.