Skip to content

Commit

Permalink
Deduplicate scrolling posts. Fixes #219 (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
dessalines committed Oct 2, 2022
1 parent bae5370 commit b24aaf5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/src/main/java/com/jerboa/ui/components/post/PostRoutines.kt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,16 @@ fun fetchPostsRoutine(
if (clear) {
posts.clear()
}
posts.addAll(newPosts)

val newPostsDeduped = newPosts.filterNot { pv ->
posts.map { op -> op.post.id }.contains(
pv
.post.id
)
}

posts.addAll(newPostsDeduped)

loading.value = false
}
}
Expand Down

0 comments on commit b24aaf5

Please sign in to comment.