ui: reconcile queue edits against current rows

This commit is contained in:
austinried
2026-11-14 12:05:29 +00:00
parent b95b8c3569
commit 31e4596860
@@ -180,7 +180,7 @@ class QueueViewModel(
rows.clear() rows.clear()
return return
} }
val start = (rows.minOfOrNull { it.position } ?: 0L).coerceIn(0, snapshot.size - 1) val start = ((rows.minOfOrNull { it.position } ?: OLDER_LOAD.toLong()) - OLDER_LOAD.toLong()).coerceAtLeast(0)
val rawEnd = (rows.maxOfOrNull { it.position } ?: (start + QUEUE_CHUNK - 1)).coerceIn(start, snapshot.size - 1) val rawEnd = (rows.maxOfOrNull { it.position } ?: (start + QUEUE_CHUNK - 1)).coerceIn(start, snapshot.size - 1)
val end = rawEnd.coerceAtMost(start + MAX_SCAN_POSITIONS - 1) val end = rawEnd.coerceAtMost(start + MAX_SCAN_POSITIONS - 1)
val loaded = queueRepository.range(snapshot, start, end).filter(::visible) val loaded = queueRepository.range(snapshot, start, end).filter(::visible)