Re-read the event detail when the same occurrence is reopened (#196) (#206)

Reviewed-on: https://codeberg.org/jlmakiola/calendula/pulls/206
This commit is contained in:
Jean-Luc Makiola
2026-08-17 18:15:53 +02:00
2 changed files with 110 additions and 1 deletions

View File

@@ -78,9 +78,15 @@ class EventDetailViewModel @Inject constructor(
* the occurrence's own times (from `CalendarContract.Instances`); they
* override the series DTSTART/DTEND so recurring events show the correct
* date instead of the first occurrence.
*
* Re-opening the *same* occurrence always re-reads it. The view model
* outlives the sheet, and a `StateFlow` conflates an identical value away,
* so assigning the target alone would leave an edit that changed no time —
* adding a description, say (#196) — showing the state from before the save.
*/
fun open(eventId: Long, beginMillis: Long, endMillis: Long) {
_target.value = Target(eventId, beginMillis, endMillis)
val target = Target(eventId, beginMillis, endMillis)
if (_target.value == target) _reload.value += 1 else _target.value = target
}
/** Re-run the current load after a failure. */