From 32d66f0a42e9406550e53117451846e6956590dd Mon Sep 17 00:00:00 2001 From: xfy Date: Mon, 6 Jul 2026 19:09:26 +0800 Subject: [PATCH] fix(shift): subscribe shiftPattern to trigger recomposition on refresh --- core/src/main/kotlin/plus/rua/project/ui/CalendarMonthView.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/main/kotlin/plus/rua/project/ui/CalendarMonthView.kt b/core/src/main/kotlin/plus/rua/project/ui/CalendarMonthView.kt index 1d3a9a2..f894432 100644 --- a/core/src/main/kotlin/plus/rua/project/ui/CalendarMonthView.kt +++ b/core/src/main/kotlin/plus/rua/project/ui/CalendarMonthView.kt @@ -142,6 +142,7 @@ fun CalendarMonthView( val today = remember { Clock.System.todayIn(TimeZone.currentSystemDefault()) } val uiState by viewModel.uiState.collectAsState() + val shiftPattern by viewModel.shiftPattern.collectAsState() val selectedDate = uiState.selectedDate val currentYear = selectedDate.year val currentMonth = selectedDate.month.number @@ -270,7 +271,7 @@ fun CalendarMonthView( viewModel.selectDate(date) } } - val shiftKindAt = remember(viewModel) { + val shiftKindAt = remember(viewModel, shiftPattern) { { date: LocalDate -> viewModel.shiftKindAt(date) } } val onRowHeightMeasured = remember { @@ -626,6 +627,7 @@ private fun BottomCardArea( val shouldShow = hasLoaded val uiState by viewModel.uiState.collectAsState() + val shiftPattern by viewModel.shiftPattern.collectAsState() val shiftKind = viewModel.shiftKindAt(uiState.selectedDate) if (shouldShow) {