mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-15 01:47:03 +05:30
fix(common): reintroduce handling for first views for comment state
This commit is contained in:
parent
1dfcda4a64
commit
1cbd3b5bd0
1 changed files with 5 additions and 1 deletions
|
@ -40,8 +40,12 @@ internal fun createListNode(
|
||||||
comments: List<Comment>,
|
comments: List<Comment>,
|
||||||
commentState: PostComments,
|
commentState: PostComments,
|
||||||
): MutableList<CommentNode> {
|
): MutableList<CommentNode> {
|
||||||
|
// Only check unread state if there any comments read in the first place. This somewhat restores
|
||||||
|
// the first view behavior from when `commentState` was nullable.
|
||||||
|
val hasUnread = commentState.commentIds.isNotEmpty()
|
||||||
|
val isUnread =
|
||||||
|
if (hasUnread) ({ id: String -> !commentState.commentIds.contains(id) }) else { _ -> false }
|
||||||
val commentNodes = mutableListOf<CommentNode>()
|
val commentNodes = mutableListOf<CommentNode>()
|
||||||
val isUnread = { id: String -> !commentState.commentIds.contains(id) }
|
|
||||||
|
|
||||||
for (i in comments.indices) {
|
for (i in comments.indices) {
|
||||||
if (comments[i].parentComment == null) {
|
if (comments[i].parentComment == null) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue