fix(android): drop second loop jump in supersededLikeToggleIds (detekt)
android / Build + lint + test (push) Successful in 3m51s

LoopWithTooManyJumpStatements — replace the two continues with a
filtered sequence + a single null guard.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-11 12:11:54 -04:00
parent d2a22e49e3
commit 4ecb1680bf
@@ -135,15 +135,18 @@ class MutationReplayer @Inject constructor(
private fun supersededLikeToggleIds(rows: List<CachedMutationEntity>): Set<Long> { private fun supersededLikeToggleIds(rows: List<CachedMutationEntity>): Set<Long> {
val latestByEntity = HashMap<String, Long>() val latestByEntity = HashMap<String, Long>()
val superseded = HashSet<Long>() val superseded = HashSet<Long>()
for (row in rows) { rows.asSequence()
if (row.kind != MutationKind.LIKE_TOGGLE) continue .filter { it.kind == MutationKind.LIKE_TOGGLE }
val decoded = runCatching { .forEach { row ->
json.decodeFromString(LikeTogglePayload.serializer(), row.payload) val decoded = runCatching {
}.getOrNull() ?: continue json.decodeFromString(LikeTogglePayload.serializer(), row.payload)
val key = "${decoded.entityType}:${decoded.entityId}" }.getOrNull()
// `rows` is ascending by id, so a prior entry is always older. if (decoded != null) {
latestByEntity.put(key, row.id)?.let(superseded::add) val key = "${decoded.entityType}:${decoded.entityId}"
} // `rows` is ascending by id, so a prior entry is always older.
latestByEntity.put(key, row.id)?.let(superseded::add)
}
}
return superseded return superseded
} }