Skip to content

Commit

Permalink
Augment UB-allowing optimization with more strict check
Browse files Browse the repository at this point in the history
Previously, if any of LoadStates is Loading, blacklist or safe mode changes were ignored
HeroBrine1st committed Jan 21, 2024
1 parent 9ae568f commit 9d450e8
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
@@ -30,7 +30,6 @@ import ru.herobrine1st.e621.util.debug
import ru.herobrine1st.e621.util.getAtIndex2DOrNull
import ru.herobrine1st.e621.util.indexOfFirst2D
import ru.herobrine1st.paging.api.Snapshot
import ru.herobrine1st.paging.internal.UpdateKind

data class IndexContainer(
/**
@@ -65,7 +64,7 @@ inline fun <K : Any> Flow<Snapshot<K, PostListingItem>>.correctFirstVisibleItem(
crossinline getFirstVisibleItemIndex: () -> Int,
crossinline setIndex: (IndexContainer) -> Unit,
) = runningReduce { previous, current ->
if (current.updateKind is UpdateKind.StateChange) return@runningReduce current
if (previous.pages == current.pages) return@runningReduce current

val firstVisibleItemIndex = getFirstVisibleItemIndex()
val currentlyObservedValue =

0 comments on commit 9d450e8

Please sign in to comment.