Give conflict resolution a busy state and a saveable list key - #115
Conversation
in-jun
left a comment
There was a problem hiding this comment.
Both fixes look correct and are cleanly unified behind the new ConflictItem.key.
#102 — saveable list key. Swapping the kotlin.Pair for "$pairId:$conflictCopyPath" satisfies the Bundle-saveable contract, and uniqueness is preserved: a Long never contains a colon, so the mapping from (pairId, conflictCopyPath) to the string is injective. Consistent with HomeScreen's scalar key.
#72 — in-progress state. The resolving set mirrors the established _syncing pattern well — the re-tap guard and set insertion happen synchronously on the main thread before launch (same as syncPair), so a rapid double-tap can't slip through, and the try/finally re-enables the card on the StaleConflictException path so a retry is possible. Disabling the buttons plus the spinner reads clearly.
A couple of things I checked that hold up: key being a computed val keeps it out of equals/hashCode, so matching against the string set survives the list refresh creating new ConflictItem instances; and the fire-and-forget final refreshConflicts() leaves only a brief window where a resolved card is still tappable, which remains a safe no-op via the storage.probe(...) == null check — same as before this change.
Tightly scoped to the two issues. LGTM."
The Conflicts screen keyed its list on a raw
Pairand gave the resolution buttons no in-progress feedback. Both are addressed here, sharing a single stable identity via a newConflictItem.key.LazyColumnitem key with a saveableString("pairId:conflictCopyPath") instead of akotlin.Pair, which can't be written to aBundleand would throw once any per-itemrememberSaveableor scroll restoration keyed on it is added.resolvingset; while a conflict's resolution and follow-up sync run, its card's buttons are disabled and a progress indicator is shown, so a re-tap can't land on the already-resolved no-op. This mirrors the syncing stateHomeScreen's card already uses.Fixes #102
Fixes #72