fix(edit): stop cursor jumping in event text fields

The event form's state pipeline ran .flowOn(io) over the whole combine,
including the _form round-trip every keystroke depends on. That async hop
handed BasicTextField a lagging value while typing, so Compose kept
correcting the cursor to the stale position.

Scope flowOn(io) to just the calendar/prefs/settings reads and collect the
form -> state -> UI path on the main dispatcher, so keystrokes round-trip
synchronously and the cursor stays put.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-15 21:16:32 +02:00
parent f990af1cb0
commit 9a1903e6ed
2 changed files with 8 additions and 2 deletions

View File

@@ -109,7 +109,7 @@ class EventEditViewModel @Inject constructor(
prefs.lastUsedCalendarId,
settingsPrefs.defaultFormFields,
::ExternalInputs,
),
).flowOn(io),
) { local, external ->
val form = local.form ?: return@combine null
val resolvedId = form.calendarId
@@ -131,7 +131,6 @@ class EventEditViewModel @Inject constructor(
resolved.rrule != local.editTarget.original.rrule,
)
}
.flowOn(io)
.stateIn(
scope = viewModelScope,
started = SharingStarted.WhileSubscribed(5_000L),