Fixed
Status Update
Comments
so...@google.com <so...@google.com>
ch...@google.com <ch...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 700259f0afe267dfe78b93db932a3cfd827a119d
Author: Sherry Hu <shuanghu@google.com>
Date: Mon May 10 14:23:09 2021
Add transition motion between fold and unfold.
Bug: 186211031
Test: manual
Change-Id: Id60f07311eca2d94ef91dc28ae45823a475160b4
M slidingpanelayout/slidingpanelayout/build.gradle
M slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/FoldTest.kt
M slidingpanelayout/slidingpanelayout/src/main/java/androidx/slidingpanelayout/widget/SlidingPaneLayout.java
https://android-review.googlesource.com/1702066
Branch: androidx-main
commit 700259f0afe267dfe78b93db932a3cfd827a119d
Author: Sherry Hu <shuanghu@google.com>
Date: Mon May 10 14:23:09 2021
Add transition motion between fold and unfold.
Bug: 186211031
Test: manual
Change-Id: Id60f07311eca2d94ef91dc28ae45823a475160b4
M slidingpanelayout/slidingpanelayout/build.gradle
M slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/FoldTest.kt
M slidingpanelayout/slidingpanelayout/src/main/java/androidx/slidingpanelayout/widget/SlidingPaneLayout.java
ch...@google.com <ch...@google.com> #3
A workaround that will work now and into the future is using onCommit
instead of launchInComposition()
:
val scope = rememberCoroutineScope()
onCommit(inventory) {
scope.launch {
val currentInventory = inventory.value
withContext(Dispatchers.IO) {
currentInventory.fetchItems()
}
}
}
This has the unfortunate effect in dev17
and alpha1
of waiting a frame for launch to happen. This is fixed and will be released in alpha2
. You can avoid this deferring by using onPreCommit
now and then switch to using onCommit
in alpha2
and beyond (which will deprecate onPreCommit
and onCommit
will switch to being the current behavior of onPreCommit
). It is still unclear what should happen for the launchInComposition()
case but we are thinking about it.
Again, the above work-around should not be necessary but will get you past this problem. I will leave this open until we have a solution.
ch...@google.com <ch...@google.com>
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 803f067eb6fbc77ca403f71fd65e32b96d3630d4
Author: Adam Powell <adamp@google.com>
Date: Fri Aug 28 12:32:58 2020
launchInComposition now launches dispatched
launchInComposition no longer launches as an undispatched coroutine. The
initial rationale for this behavior was to allow for subscriptions that
synchronously emit a first value or any other work that happens before
first suspension to have their results reflected more quickly, but this
produces inconsistent results for the frame, where composition and
layout/draw may see different values.
Remove the undispatched launch and let the coroutine launch proceed
normally.
Fixes: 166486000
Test: SuspendingEffectsTests.kt
Relnote: "launchInComposition no longer launches coroutines undispatched"
Change-Id: Ief6afbbd9cae98ef337808a5cb481f012df602c8
M compose/runtime/runtime/src/androidAndroidTest/kotlin/androidx/compose/runtime/SuspendingEffectsTests.kt
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Recomposer.kt
https://android-review.googlesource.com/1414949
Branch: androidx-master-dev
commit 803f067eb6fbc77ca403f71fd65e32b96d3630d4
Author: Adam Powell <adamp@google.com>
Date: Fri Aug 28 12:32:58 2020
launchInComposition now launches dispatched
launchInComposition no longer launches as an undispatched coroutine. The
initial rationale for this behavior was to allow for subscriptions that
synchronously emit a first value or any other work that happens before
first suspension to have their results reflected more quickly, but this
produces inconsistent results for the frame, where composition and
layout/draw may see different values.
Remove the undispatched launch and let the coroutine launch proceed
normally.
Fixes: 166486000
Test: SuspendingEffectsTests.kt
Relnote: "launchInComposition no longer launches coroutines undispatched"
Change-Id: Ief6afbbd9cae98ef337808a5cb481f012df602c8
M compose/runtime/runtime/src/androidAndroidTest/kotlin/androidx/compose/runtime/SuspendingEffectsTests.kt
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Recomposer.kt
Description
Compose options:
Updating a MutableState value in the backgroung, sometimes I get the following error:
Code to reproduce is attached. See
@Composable TestSnapshotCrash()
It's a simple layout with 3 Tabs and a LazyColumn. Changing the tab, a new list is created in the background and assigned to a mutablestate. That state is used in the lazycolumn. If you change the tab very quickly and many times, the crash should happen.