Comment about rememberSwipeToDismissBoxState usage

This commit is contained in:
FooIbar committed 2025-02-21 20:32:15 +08:00
1 parent 881b76fa3e
commit 5f6f979bce
2 files changed
+2

No files matched your search

@@ -339,6 +339,7 @@ fun AnimatedVisibilityScope.DownloadsScreen(navigator: DestinationsNavigator) =
val index by rememberUpdatedState(itemIndex)
val item by rememberUpdatedState(label)
// Not using rememberSwipeToDismissBoxState to prevent LazyColumn from reusing it
// SQLite may reuse ROWIDs from previously deleted rows so they'll have the same key
val dismissState = remember { SwipeToDismissBoxState(SwipeToDismissBoxValue.Settled, density) }
LaunchedEffect(dismissState) {
snapshotFlow { dismissState.currentValue }.collect {
@@ -364,6 +364,7 @@ fun AnimatedVisibilityScope.GalleryListScreen(lub: ListUrlBuilder, navigator: De
animateItemModifier = Modifier.thenIf(animateItems) { animateItem() },
) { isDragging ->
// Not using rememberSwipeToDismissBoxState to prevent LazyColumn from reusing it
// SQLite may reuse ROWIDs from previously deleted rows so they'll have the same key
val dismissState = remember { SwipeToDismissBoxState(SwipeToDismissBoxValue.Settled, density) }
LaunchedEffect(dismissState) {
snapshotFlow { dismissState.currentValue }.collect { value ->