From 4098bcfc2f05d6a25a82115e9c47f3da9865fcc9 Mon Sep 17 00:00:00 2001 From: Sadturtleman Date: Thu, 8 Oct 2026 21:50:52 +0900 Subject: [PATCH] =?UTF-8?q?refactor(home):=20=EC=A3=BC=EA=B0=84=20?= =?UTF-8?q?=EB=8B=AC=EB=A0=A5=EC=9D=98=20=EC=9B=94=EB=B3=84=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=EB=A5=BC=20=EB=8F=99=EC=8B=9C=EC=97=90=20=EB=B6=80?= =?UTF-8?q?=EB=A5=B8=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - HomeViewModel.loadWeek: 주가 두 달에 걸치면 두 달 달력을 async 로 함께 받는다. 달별 실패는 지금처럼 빈 목록으로 흡수한다 Co-Authored-By: Claude Opus 5.5 (1M context) --- .../ruleup/home/presentation/viewmodel/HomeViewModel.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/home/presentation/src/main/kotlin/com/ruleup/home/presentation/viewmodel/HomeViewModel.kt b/home/presentation/src/main/kotlin/com/ruleup/home/presentation/viewmodel/HomeViewModel.kt index 4f9a38b0..0003811a 100644 --- a/home/presentation/src/main/kotlin/com/ruleup/home/presentation/viewmodel/HomeViewModel.kt +++ b/home/presentation/src/main/kotlin/com/ruleup/home/presentation/viewmodel/HomeViewModel.kt @@ -160,9 +160,14 @@ class HomeViewModel val monday = today.minusDays((today.dayOfWeek.value - 1).toLong()) val week = (0L..6L).map { monday.plusDays(it).toString() }.toSet() val months = listOf(monday, monday.plusDays(6)).map { it.toString().take(7) }.distinct() + val days = + coroutineScope { + months + .map { month -> async { runCatching { myPageRepository.getCalendar(month).days }.getOrDefault(emptyList()) } } + .awaitAll() + }.flatten() val statuses = - months - .flatMap { month -> runCatching { myPageRepository.getCalendar(month).days }.getOrDefault(emptyList()) } + days .filter { it.date in week } .mapNotNull { day -> day.status?.let { day.date to it } } .toMap()