fix(zap settings): de-dupe preset amounts so drag-reorder + chip keys stay valid

addAmount() allowed adding the same amount twice; two preset chips then share the
same key(amount) (Compose duplicate-key hazard) and the drag-reorder's
indexOf(amount) resolves to the wrong chip. De-dupe on add.

https://claude.ai/code/session_01HNE2z7CSYZ2G8KwC5fziJn
This commit is contained in:
Claude
2026-05-30 02:16:39 +00:00
parent 380122bcb5
commit 93648085f9
@@ -72,7 +72,10 @@ class UpdateZapAmountViewModel : ViewModel() {
fun addAmount() {
val newValue = nextAmount.text.trim().toLongOrNull()
if (newValue != null) {
// De-dupe: a repeated amount would give two preset chips the same key (a
// Compose duplicate-key hazard) and make the drag-reorder's indexOf()
// resolve to the wrong chip.
if (newValue != null && newValue !in amountSet) {
amountSet = amountSet + newValue
}