findfamily: don't reuse sender's row id for received locations
- Commit
3a2db8866fe2266e985bed5a6e0fda8019b30397- Author
- Vayun Mathur <[email protected]>
- When
- 2026-08-15 00:12 UTC (3 months ago)
- Parents
929d264
Diff
findfamily/src/main/java/com/vayunmathur/findfamily/data/LocationValue.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/data/LocationValue.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/data/LocationValue.ktindex 1f9a6910c0..de951ecbb8 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/data/LocationValue.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/data/LocationValue.kt@@ -57,7 +57,12 @@ data class LocationValueCompatible( acc = acc, timestamp = Instant.fromEpochMilliseconds(timestamp), battery = battery,- id = id.toLong()+ // NOT id = id.toLong(): `id` is the *sender's* local autogenerate primary+ // key. Reusing it here makes @Upsert collide across devices (every device's+ // ids grow from 1 in lockstep), so peers overwrite each other's — and your+ // own — rows by PK, leaving getLatest() with stale data. Use 0 so Room+ // assigns a fresh local id and each received fix is stored as its own row.+ id = 0, ) } }\ No newline at end of file