diff --git a/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentNode.kt b/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentNode.kt index 86b4e027..71a045c3 100644 --- a/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentNode.kt +++ b/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentNode.kt @@ -40,8 +40,12 @@ internal fun createListNode( comments: List, commentState: PostComments, ): MutableList { + // 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() - val isUnread = { id: String -> !commentState.commentIds.contains(id) } for (i in comments.indices) { if (comments[i].parentComment == null) {