deferring-state-reads
CommunityShift hot state reads from Compose to Layout/Draw
Software Engineering#recomposition#layout-inspector#compose-performance#deferring-state-reads#lambda-modifiers#layout-draw#graphics-layer
Authorskydoves
Version1.0.0
Installs0
System Documentation
What problem does it solve?
Deferring hot Compose state reads from the Composition phase to Layout or Draw reduces per-frame recomposition by moving state reads into lambda modifiers, enabling smoother UI with frequent changes like scroll or animation.
Core Features & Use Cases
- Move state reads like scroll offsets, animation progress, and drag deltas into lambda modifiers such as Modifier.offset { }, Modifier.layout { }, Modifier.graphicsLayer { }, and Modifier.drawBehind { }.
- Hoist hot values across composables using lambda providers (() -> T) so only the Layout/Draw phase reads trigger invalidation.
- Verify performance improvements with Layout Inspector or @TraceRecomposition while preserving visuals and behavior.
Quick Start
Identify a hot state read in a composable body and replace a value-form modifier with a lambda modifier to move the read into the Layout or Draw phase.
Dependency Matrix
Required Modules
None requiredComponents
references
💻 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: deferring-state-reads Download link: https://github.com/skydoves/compose-performance-skills/archive/main.zip#deferring-state-reads 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 510,000+ vetted skills library on demand.