mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-15 00:42:54 +01:00
queue: invalidate keyset cursors on edits
This commit is contained in:
@@ -1094,6 +1094,7 @@ class QueueRepository(
|
||||
dao.insert(entries.mapIndexed { index, entry -> entry.copy(id = 0, position = index.toLong()) })
|
||||
}
|
||||
}
|
||||
keyCache.clear()
|
||||
queueVersion.incrementAndGet()
|
||||
}
|
||||
|
||||
@@ -1106,6 +1107,7 @@ class QueueRepository(
|
||||
)
|
||||
}
|
||||
}
|
||||
keyCache.clear()
|
||||
queueVersion.incrementAndGet()
|
||||
}
|
||||
|
||||
|
||||
@@ -458,6 +458,18 @@ class QueueRepositoryTest {
|
||||
assertEquals(3L, repository.remapPosition(updated, point.current!!))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aRemovalDoesNotReusePreEditKeysetRows() =
|
||||
runTest {
|
||||
seedLibrary()
|
||||
val snapshot = repository.snapshotAfter(listOf(repository.albumEntry(1, "al1")))
|
||||
assertEquals("s1", repository.itemAt(snapshot, 0)?.song?.id)
|
||||
|
||||
repository.removeAt(snapshot, 0)
|
||||
|
||||
assertEquals(listOf("s2", "s3"), resolveAll(repository.snapshot()))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun anUnrelatedOriginResetRemapsWithinTheSecondUnchangedFragment() =
|
||||
runTest {
|
||||
|
||||
Reference in New Issue
Block a user