desktop: document the reaction-rollback race as an accepted edge

Sami flagged in review that onError rolls back to the onMutate snapshot,
so a real event backfilled between onMutate and onError is dropped by the
rollback. It needs a relay error racing an in-flight backfill and
self-heals on the next backfill — vanishingly rare, not worth guarding.
Comment-only, documents the known edge.

Co-authored-by: Tyler Longwell <tlongwell@block.xyz>
Signed-off-by: Tyler Longwell <tlongwell@block.xyz>
This commit is contained in:
npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d
2026-06-21 10:04:25 -04:00
parent d93c7d78f8
commit b089618dd0

View File

@@ -591,6 +591,10 @@ export function useToggleReactionMutation() {
},
onError: (_error, _variables, context) => {
if (context) {
// Rollback restores the pre-click snapshot. Narrow accepted edge: if a
// backfill landed a real event between onMutate and onError, this drops
// it too — but that needs a relay error racing an in-flight backfill,
// and the next backfill self-heals it. Not worth guarding.
queryClient.setQueryData<RelayEvent[]>(
context.queryKey,
context.previous,