Skip to content

Commit 78c6c7d

Browse files
committed
[BOOK-244] refactor: coroutineScope -> rememberCoroutineScope로 변경
cancellationException throw 구문 제거
1 parent 0c3a257 commit 78c6c7d

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

feature/detail/src/main/kotlin/com/ninecraft/booket/feature/detail/book/BookDetailPresenter.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ import kotlinx.collections.immutable.ImmutableList
3535
import kotlinx.collections.immutable.persistentListOf
3636
import kotlinx.collections.immutable.toImmutableList
3737
import kotlinx.collections.immutable.toPersistentList
38-
import kotlinx.coroutines.CancellationException
3938
import kotlinx.coroutines.async
40-
import kotlinx.coroutines.coroutineScope
4139
import kotlinx.coroutines.launch
4240
import java.time.LocalDateTime
4341

@@ -78,11 +76,11 @@ class BookDetailPresenter @AssistedInject constructor(
7876
var sideEffect by rememberRetained { mutableStateOf<BookDetailSideEffect?>(null) }
7977

8078
@Suppress("TooGenericExceptionCaught")
81-
suspend fun initialLoad() {
79+
fun initialLoad() {
8280
uiState = UiState.Loading
8381

8482
try {
85-
coroutineScope {
83+
scope.launch {
8684
val bookDetailDef = async { bookRepository.getBookDetail(screen.isbn13).getOrThrow() }
8785
val seedsDef = async { bookRepository.getSeedsStats(screen.userBookId).getOrThrow() }
8886
val readingRecordsDef = async {
@@ -109,8 +107,6 @@ class BookDetailPresenter @AssistedInject constructor(
109107

110108
uiState = UiState.Success
111109
}
112-
} catch (ce: CancellationException) {
113-
throw ce
114110
} catch (e: Throwable) {
115111
uiState = UiState.Error(e)
116112

0 commit comments

Comments
 (0)