Skip to content

Commit 145188c

Browse files
committed
fix: viewModelScope background thread에서 postValue로 입력하도록 수정
1 parent afe20cc commit 145188c

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

presentation/src/main/java/com/stop/ui/route/RouteViewModel.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ class RouteViewModel @Inject constructor(
9292
viewModelScope.launch(Dispatchers.Default + coroutineExceptionHandler) {
9393
val itineraries = getRouteUseCase(routeRequest)
9494
if (itineraries.isEmpty()) {
95-
_errorMessage.value = Event(ErrorType.NO_ROUTE_RESULT)
96-
_routeResponse.value = listOf()
97-
_isLoading.value = Event(false)
95+
_errorMessage.postValue(Event(ErrorType.NO_ROUTE_RESULT))
96+
_routeResponse.postValue(listOf())
97+
_isLoading.postValue(Event(false))
9898
return@launch
9999
}
100-
this@RouteViewModel._routeResponse.value = itineraries
101-
_isLoading.value = Event(false)
100+
this@RouteViewModel._routeResponse.postValue(itineraries)
101+
_isLoading.postValue(Event(false))
102102
}
103103
}
104104

@@ -112,8 +112,7 @@ class RouteViewModel @Inject constructor(
112112
fun calculateLastTransportTime(itinerary: Itinerary) {
113113
checkClickedItinerary(itinerary)
114114
viewModelScope.launch(Dispatchers.Default + coroutineExceptionHandler) {
115-
this@RouteViewModel._lastTimeResponse.value =
116-
Event(getLastTransportTimeUseCase(itinerary))
115+
this@RouteViewModel._lastTimeResponse.postValue(Event(getLastTransportTimeUseCase(itinerary)))
117116
}
118117
}
119118

0 commit comments

Comments
 (0)