Skip to content

Commit

Permalink
refactor(ChildCommentsUiState): 불필요한 코드 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
ki960213 committed Nov 3, 2023
1 parent 80bb03b commit a9bdbdb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ChildCommentViewModel @Inject constructor(
private val _screenUiState = NotNullMutableLiveData(ScreenUiState.LOADING)
val screenUiState: NotNullLiveData<ScreenUiState> = _screenUiState

private val _comments = NotNullMutableLiveData(ChildCommentsUiState.Loading)
private val _comments = NotNullMutableLiveData(ChildCommentsUiState())
val comments: NotNullLiveData<ChildCommentsUiState> = _comments

private val _editingCommentId = MutableLiveData<Long?>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.emmsale.presentation.ui.childCommentList.uiState
import com.emmsale.data.model.Comment
import com.emmsale.presentation.ui.feedDetail.uiState.CommentUiState

data class ChildCommentsUiState(val comments: List<CommentUiState>) {
data class ChildCommentsUiState(val comments: List<CommentUiState> = emptyList()) {

fun highlight(commentId: Long) = copy(
comments = comments.map { if (it.comment.id == commentId) it.highlight() else it },
Expand All @@ -14,10 +14,6 @@ data class ChildCommentsUiState(val comments: List<CommentUiState>) {
)

companion object {
val Loading: ChildCommentsUiState = ChildCommentsUiState(
comments = emptyList(),
)

fun create(
uid: Long,
parentComment: Comment,
Expand Down

0 comments on commit a9bdbdb

Please sign in to comment.