compose-state-deferred-reads

Defer Compose state reads from composition into layout or draw blocks.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/soygabimoreno/Los-ANDROIDES --skill compose-state-deferred-reads
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compose-state-deferred-reads
Source: https://github.com/soygabimoreno/Los-ANDROIDES/tree/main/.agents/skills/compose-state-deferred-reads
Command: npx skills add https://github.com/soygabimoreno/Los-ANDROIDES --skill compose-state-deferred-reads

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents Compose performance issues caused by reading fast-changing frame-rate state (like scroll offsets or animation values) in the composition phase, which triggers excessive recomposition and cascaded invalidations.

Core Features & Use Cases

  • Defer state reads to layout/draw: Keep animated/scroll/gesture values as State and read .value inside value-form modifier blocks such as Modifier.offset { ... } or inside draw blocks like drawBehind.
  • Avoid back-writing across phases: Stop observable state from being written in layout/draw and then read in composition (or written in composition and read earlier in the same pass), which can create extra invalidation cycles.
  • Use provider lambdas across composable boundaries: Pass () -> T providers instead of snapshot values when values change every frame and are consumed by modifiers deep in the UI tree.
  • Handle measurement dependencies correctly: When one row’s measured size affects another row, apply the measured constraint during measure/layout rather than reading the measurement state in composition.

Quick Start

Use the compose-state-deferred-reads Skill when you notice recomposition counters climb during scrolling or animation even when your underlying data is stable.

Frequently Asked Questions about compose-state-deferred-reads

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

FAQPage Schema
Why does Jetpack Compose stutter during scroll and animation even when data is stable?

Compose scroll stutter often happens when fast-changing state like scroll offsets or animation values are read during the composition phase, triggering excessive recomposition and cascading invalidations across the UI tree.

How do I defer state reads in Jetpack Compose to prevent excessive recomposition?

To defer state reads in Jetpack Compose, keep animated or scroll values as State<T> and read the .value inside block-form modifier lambdas like Modifier.offset { ... } or draw blocks such as drawBehind instead of the composition phase.

What is the best way to pass fast-changing animation values across composable boundaries?

The best way to pass fast-changing animation values across composable boundaries is using provider lambdas like () -> T instead of snapshot values, preventing deep UI tree recomposition when values change every frame.

How do I handle measurement dependencies between rows in Jetpack Compose without causing recomposition?

Handle measurement dependencies between rows by applying measured constraints during the measure or layout phase rather than reading the measurement state in composition, avoiding unnecessary recomposition cycles.

What are the limitations of deferring Compose state reads to layout and draw phases?

Deferring Compose state reads requires avoiding snapshot back-writing across phases, meaning observable state must not be written in layout or draw and then read in composition, as this creates extra invalidation cycles.