Skip to content

Commit

Permalink
fix: observe comment count outside of lifecycle aware block (#6961)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pittvandewitt authored Jan 16, 2025
1 parent 844b7d1 commit 31ec3bb
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,16 @@ class CommentsMainFragment : Fragment() {
commentPagingAdapter.submitData(it)
}
}
}
}

launch {
viewModel.commentCountLiveData.observe(viewLifecycleOwner) { commentCount ->
if (commentCount == null) return@observe
viewModel.commentCountLiveData.observe(viewLifecycleOwner) { commentCount ->
if (commentCount == null) return@observe

commentsSheet?.updateFragmentInfo(
false,
getString(R.string.comments_count, commentCount.formatShort())
)
}
}
}
commentsSheet?.updateFragmentInfo(
false,
getString(R.string.comments_count, commentCount.formatShort())
)
}
}

Expand Down

0 comments on commit 31ec3bb

Please sign in to comment.