Gurupreet / ComposeCookBook

A Collection on all Jetpack compose UI elements, Layouts, Widgets and Demo screens to see it's potential
MIT License
6.3k stars 799 forks source link

App crashes on scrolling too fast in the advance list sections #23

Closed kriticalflare closed 4 years ago

kriticalflare commented 4 years ago

Describe the bug App crashes on scrolling too fast in the advance list sections

To Reproduce Steps to reproduce the behavior:

  1. Go to advance lists
  2. Click on any of the advance list variants (fade , rotatex etc)
  3. Scroll very fast
  4. App crashes

Expected behavior The app to not crash

Smartphone (please complete the following information):

Stacktrace

2020-11-02 20:40:08.461 26577-26577/com.guru.composecookbook E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.guru.composecookbook, PID: 26577
    java.lang.IllegalArgumentException: Layer is redrawn for LayoutNode in state NeedsRelayout [LayoutNode@9095ce3 children: 0 measureBlocks: MeasuringIntrinsicsMeasureBlocks@ddbe6e0{ measureBlock=androidx.compose.foundation.ImageKt$Image$1$1@839bd99 }]
        at androidx.compose.ui.node.LayerWrapper.invoke(LayerWrapper.kt:167)
        at androidx.compose.ui.node.LayerWrapper.invoke(Unknown Source:3)
        at androidx.compose.ui.platform.RenderNodeApi29$record$1$1.invoke(RenderNodeApi29.kt:152)
        at androidx.compose.ui.platform.RenderNodeApi29$record$1$1.invoke(Unknown Source:0)
        at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:1721)
        at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:128)
        at androidx.compose.ui.platform.AndroidComposeView.observeLayerModelReads(AndroidComposeView.kt:485)
        at androidx.compose.ui.platform.RenderNodeApi29.record(RenderNodeApi29.kt:151)
        at androidx.compose.ui.platform.RenderNodeLayer.updateDisplayList(RenderNodeLayer.kt:191)
        at androidx.compose.ui.platform.AndroidComposeView.dispatchDraw(AndroidComposeView.kt:554)
        at android.view.View.draw(View.java:21985)
        at android.view.View.updateDisplayListIfDirty(View.java:20859)
        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4416)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4389)
        at android.view.View.updateDisplayListIfDirty(View.java:20819)
        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4416)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4389)
        at android.view.View.updateDisplayListIfDirty(View.java:20819)
        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4416)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4389)
        at android.view.View.updateDisplayListIfDirty(View.java:20819)
        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4416)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4389)
        at android.view.View.updateDisplayListIfDirty(View.java:20819)
        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4416)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4389)
        at android.view.View.updateDisplayListIfDirty(View.java:20819)
        at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:581)
        at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:587)
        at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:664)
        at android.view.ViewRootImpl.draw(ViewRootImpl.java:3767)
        at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3495)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2779)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1745)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7772)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:967)
        at android.view.Choreographer.doCallbacks(Choreographer.java:791)
        at android.view.Choreographer.doFrame(Choreographer.java:726)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)
Gurupreet commented 4 years ago

Thanks for the info I will check it out.

Gurupreet commented 4 years ago

Somehow When I use Image it's crashing because somehow Image() was still drawing but CoilImage seems to work I think could be because of cacheing. Updated to coil image for now will revisit it again after beta version.