fix(month): keep the split selection inside the month that owns it (#53)

The marker could still be caught fading in on the outgoing page. Paging changes
the selection immediately but the state only once the new month has loaded, so
until then the content key — the state's month — is unchanged and AnimatedContent
updates the page *in place*: the old grid really was told the next month's 1st
was selected, and it shows that date among its trailing days.

A page now marks only the days its own month owns. Selection always lands inside
the month it belongs to, so nothing legitimate is lost, and the phantom goes
without timing the fade against the page transition — a delay would have moved
it rather than removed it, and slowed selecting a day within a page besides.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-20 19:10:08 +02:00
parent f9619e74d9
commit 39cc70be95

View File

@@ -946,12 +946,22 @@ internal fun SplitMonthGrid(
) )
} }
week.days.forEach { day -> week.days.forEach { day ->
val inMonth = day.month == month.month && day.year == month.year
SplitDayCell( SplitDayCell(
date = day, date = day,
events = state.instancesByDay[day].orEmpty(), events = state.instancesByDay[day].orEmpty(),
isToday = day == state.today, isToday = day == state.today,
isSelected = day == selected, // A page marks only the days its own month owns. Paging
inMonth = day.month == month.month && day.year == month.year, // moves the selection before this month's replacement
// has loaded, so for a moment the grid is asked to mark
// the *next* month's 1st — a date it shows among its
// trailing days, where the marker would fade in just
// before the page slid away. Selection always lands
// inside the month it belongs to, so scoping it here
// removes that without timing anything against the
// page transition.
isSelected = day == selected && inMonth,
inMonth = inMonth,
dark = dark, dark = dark,
onClick = { onSelectDay(day) }, onClick = { onSelectDay(day) },
modifier = Modifier.weight(1f).fillMaxHeight(), modifier = Modifier.weight(1f).fillMaxHeight(),