Skip to content

Crash: "Apply is called on deactivated node" in LazyColumn #45

@Diddielou

Description

@Diddielou

The WheelView component crashes when used in scenarios where the composable is removed e.g., a bottom sheet is dismissed while the scrolling is still in progress.

Environment

  • Compose BOM: 2025.10.00
  • Compose Foundation: 1.7.x+
  • Android Target SDK: 36
  • WheelView version: 2.0.7

Steps to Reproduce

  1. Display a WheelView inside a bottom sheet or modal dialog
  2. Scroll the wheel to trigger lazy list prefetching
  3. Quickly dismiss/close the sheet while scrolling or immediately after
  4. App crashes with SubcomposeLayoutPausableCompositionException

Stack Trace

androidx.compose.ui.layout.SubcomposeLayoutPausableCompositionException: slotid=DefaultLazyKey(index=24998)
    at
androidx.compose.ui.layout.LayoutNodeSubcompositionsState.applyPausedPrecomposition(SubcomposeLayout.kt:1270)
    at androidx.compose.foundation.lazy.layout.PrefetchHandleProvider$HandleAndRequestImpl.performApply(LazyLayout
PrefetchState.kt:798)
    at
androidx.compose.foundation.lazy.layout.AndroidPrefetchScheduler.runRequest(PrefetchScheduler.android.kt:181)
    ...
Caused by: androidx.compose.runtime.ComposePausableCompositionException
Caused by: java.lang.IllegalStateException: **Apply is called on deactivated node LayoutNode@9a08937 children: 0**
measurePolicy: androidx.compose.foundation.text.EmptyMeasurePolicy@7f074a7 deactivated: true

Expected Behavior

WheelView handles composition/deactivation gracefully without crashing, even when a bottom sheet is dismissed during active scrolling or prefetching.

Proposed Fix

Add stable keys and content type to the items() call in the LazyColumn.

  1. Stable keys ensure Compose can track item identity across recompositions
  2. Content type enables efficient composition reuse

Testing

Tested with the fix with Compose BOM 2025.10.00 with multiple bottom sheets using WheelView, rapid open/close scenarios → no crashes observed after applying the fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions