跪拜 Guibai
← All articles
Frontend · Android · Flutter

Jetpack Compose 1.13 lands with computedStateOf, recomposition tracing, and captured exit animations

By 恋猫de小郭 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

These additions remove two common sources of wasted composition and memory in real apps, and the new tracing gives teams the exact state write behind any recomposition head-scratcher. None of it changes your architecture or build setup, so upgrading is low-risk and pays off where lists, dialogs, and condition-driven UI get messy.

Summary

Jetpack Compose 1.13 ships with BOM 2026.11.01, requires Kotlin 2.2+ and compileSdk 37.1, and brings Material 3 to 1.5.0 stable. The release focuses on practical tooling rather than headline features: a new computedStateOf API avoids result caching for cheap boolean conditions, an official runtime-tracing module links Perfetto records to specific state writes, LazyLayoutCacheWindow unifies list prefetch and off-screen retention, and CapturedAnimatedVisibility captures a frame so content can exit after its state is cleared.

A worked music-list example shows the new APIs cooperating: scrolling determines when the back-to-top button appears, opening and closing a track detail clears the selected song, and the exit animation no longer blocks on stale data. The post also covers progressive blur, PolygonShape and MorphPolygonShape for clips and shape animation, deprecation of Compose ConstraintLayout and MotionLayout in favor of stable FlexBox and Grid, and the removal of Modifier.onFocusedBoundsChanged.

Google's own Pokedex benchmarks on Pixel 6 show Compose 1.13 is roughly flat versus 1.12.1: TTID 147.65 ms (3.4% faster than Views), TTFD 202.79 ms (12.5% slower than Views), and zero dropped frames in scrolling. The release is a practical convergence that developers can adopt without major rewrites.

Takeaways
— Jetpack Compose 1.13 corresponds to BOM 2026.11.01 and requires Kotlin 2.2+ and compileSdk 37.1.
— computedStateOf recomputes on every read without caching, and skips invalidation when the SnapshotMutationPolicy deems the result unchanged; it suits cheap conditions like scroll thresholds.
— derivedStateOf caches results and remains the right choice for expensive computations or results read repeatedly.
— The new runtime-tracing artifact (androidx.compose.runtime:runtime-tracing:1.13.0) lets Perfetto trace a state write to its resulting recompositions on API 29+ devices, at the cost of extra string and call-stack recording.
— LazyLayoutCacheWindow lets LazyColumn, LazyVerticalGrid, and waterfall containers prefetch ahead of the viewport and retain content behind it via aheadFraction and behindFraction fractions; the default strategy tracks visible-item average size with ahead between 10% and 50% and behind at 0.
— cacheWindow configuration moved from rememberLazyListState(state) parameters to the LazyColumn(cacheWindow = ...) layout parameter.
— CapturedAnimatedVisibility removes the exiting composition immediately and continues the exit transition using a GraphicsLayer-captured frame, so business state can be cleared without blank or crashing UI; Google measures it 7–8% cheaper in exit frame time.
— CapturedAnimatedVisibility leaves a static layer: gestures, infinite animations, shared elements, and Modifier.animateEnterExit() do not keep updating on that captured frame.
— Modifier.blur { ... } with BlurRadiusSpec supports linear or radial progressive blur, including a custom AGSL RuntimeShader for radius generation, evaluated at draw time.
— PolygonShape and MorphPolygonShape in Foundation now wrap geometry as normal Shape for Modifier.clip, with Morph progress read at draw time so shape animation doesn't recompose.
— VectorPainter shares rasterized draw caches for identical static ImageVector, size, and configuration, and Modifier.border can now use a RuntimeShader as ShaderBrush.
— FlexBox and Grid moved to stable, with FlexBox's maxItemsInEachLine; Google recommends FlexBox over FlowRow/FlowColumn for new code while Compose ConstraintLayout and MotionLayout begin deprecation.
— BasicTextField value-based API and Material 2 TextField are deprecated in favor of TextFieldState; Material 3 1.5 value-based overloads are not yet deprecated.
— LineHeightStyle.Mode.PerLine applies per-line line height for mixed-font paragraphs and scripts like Myanmar, Khmer, or Thai to reduce overlap and clipping.
— Modifier.onFocusedBoundsChanged has no effect starting in 1.13; use focus node queries, onFocusChanged, and BringIntoViewRequester.
— Modifier.clickable now honors the system setting for interaction sound effects, so callers that manually play click sounds risk duplication.
— Compose UI test TestFailurePolicy can auto-capture screenshots and Semantics trees on assertion failure, with custom Handlers for CI integration.
— New alpha artifacts: androidx.web:web:1.0.0-alpha01 for WebContent (still requiring AndroidView for now) and material3-a2ui:1.0.0-alpha02 for rendering A2UI protocol descriptions.
— Google's Pokedex tests on Pixel 6 with Android 17: Compose 1.13 TTID 147.65 ms, TTFD 202.79 ms, 0% dropped frames; Views were 152.87 ms TTID, 180.32 ms TTFD, and scroll frame P50 was Compose 3.51 ms vs Views 3.06 ms.
Conclusions

Google's performance numbers show the framework's runtime cost is not dropping much, but the workflow payoff is real: recomposition tracing and computedStateOf attack the most common cause of UI jank modeling mistakes on Android, not just frame rates.

CapturedAnimatedVisibility changes a core Compose contract, accepting a static exit frame. That trade is sensible for most exit animations, but it quietly caps what an exit transition can do, so teams with animated content in their leaving views need to test before adopting.

The deliberate split between computedStateOf and derivedStateOf pushes more design onto the developer; choosing correctly depends on knowing whether the computation is cheap enough to redo on every read. That kind of decision is now a documented API choice rather than an implementation detail.

The recommendation to deprecate ConstraintLayout and MotionLayout in Compose while pushing FlexBox and Grid signals Google is shrinking Compose's layout surface toward modern web-like primitives; teams with heavy ConstraintLayout usage should plan a migration path now.

Concepts & terms
computedStateOf
A Compose runtime API that derives a computed state value without caching the result; each read recomputes, but dependent recompositions are skipped when SnapshotMutationPolicy says the result is equal. Best for lightweight conditions like scroll thresholds.
derivedStateOf
The long-standing Compose API for deriving state from other state. It caches the computed result and only recomputes when a dependency changes, making it appropriate for expensive calculations or results read often.
Recomposition tracing
A new Compose runtime tracing feature that records State reads/writes, write call stacks, and arrows from a write to its recomposition in Perfetto, helping developers connect a recomposition to the exact state change that caused it.
LazyLayoutCacheWindow
A configuration for Compose lazy lists, grids, and waterfall layouts that controls prefetching ahead of the viewport and retaining items behind it, balancing fluing performance against off-screen memory usage.
CapturedAnimatedVisibility
An AnimatedVisibility mode that captures the exiting content's final frame with GraphicsLayer and removes it from composition immediately; the captured frame then runs the exit transition, allowing the underlying data to be cleared without mid-animation reads.
BlurRadiusSpec
A specification for progressive blur in the Modifier.blur lambda, letting the blur radius vary linearly, radially, or by a custom AGSL RuntimeShader during the draw phase.
MorphPolygonShape
A Foundation Shape that interpolates between polygon geometries, with its progress lambda evaluated at draw time so shape morphing animations skip recomposition.
A2UI
A protocol for describing Android UI in a structured format that AI agents can generate and a Compose renderer can execute, currently available as material3-a2ui:1.0.0-alpha02.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗