Skip to content

Commit

Permalink
refactor(#286): spaceMap을 이용한 코드를 nowSpace를 활용하도록 리팩토링
Browse files Browse the repository at this point in the history
  • Loading branch information
yang1318 committed Dec 13, 2023
1 parent a5d8226 commit 928c5cd
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,11 @@ class MainViewModel
fun getSpaces() {
viewModelScope.launch(coroutineExceptionHandler) {
profileSpaceRepository.getSpaces().collectLatest { responseSpaces ->
val spaceMap: Map<String, Space> =
_uiState.value.spaces.associateBy { space -> space.id }
val newSpaces = mutableListOf<Space>()
responseSpaces.forEach { space ->
if (spaceMap.containsKey(space.id)) {
newSpaces.add(space.copy(isSelected = spaceMap[space.id]!!.isSelected))
val newSpaces = responseSpaces.map { space ->

Check failure on line 53 in AOS/app/src/main/java/boostcamp/and07/mindsync/ui/main/MainViewModel.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] AOS/app/src/main/java/boostcamp/and07/mindsync/ui/main/MainViewModel.kt#L53 <standard:multiline-expression-wrapping>

A multiline expression should start on a new line
Raw output
AOS/app/src/main/java/boostcamp/and07/mindsync/ui/main/MainViewModel.kt:53:37: error: A multiline expression should start on a new line (standard:multiline-expression-wrapping)
if (space.id == _uiState.value.nowSpace?.id) {
space.copy(isSelected = true)
} else {
newSpaces.add(space)
space
}
}
_uiState.update { uiState ->
Expand Down

0 comments on commit 928c5cd

Please sign in to comment.