compose-state-hoisting
CommunityHoist Compose state only where it’s needed.
Software Engineering#mvvm#ui architecture#jetpack compose#viewmodel#state hoisting#rememberSaveable#composition ownership
Authorsoygabimoreno
Version1.0.0
Installs0
System Documentation
What problem does it solve?
It prevents Compose UIs from becoming harder to maintain by ensuring UI state lives at the right ownership level instead of being hoisted too far or mixed with business logic.
Core Features & Use Cases
- State ownership decision guide: Choose local
rememberstate, hoisted composable parameters, a plain state holder, or a screen-levelViewModelbased on who reads/writes the state and what logic it drives. - Plain state holder extraction: Extract a
@Stablestate holder when multiple coordinated UI concerns and named operations (e.g., clear, jumpToTop, openFilters) make the composable hard to test and preview. - Composition-scoped suspend operations: Keep scroll/drawer animation suspend calls in composition-owned coroutines (e.g.,
rememberCoroutineScope/LaunchedEffect) rather than inviewModelScope. - Saving state correctly: Use
rememberSaveable/customSaverfor minimal serializable values that must survive recreation (e.g., query string), while avoiding runtime objects likeLazyListStateorFocusRequester.
Quick Start
Apply the decision guide in the Compose UI you are building and move each state to the lowest common composable owner, using a plain state holder only when the UI mechanics need coordinated named operations.
Dependency Matrix
Required Modules
None requiredComponents
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: compose-state-hoisting Download link: https://github.com/soygabimoreno/Los-ANDROIDES/archive/main.zip#compose-state-hoisting Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.