From b089618dd07993b862e13134c69a73efa78c2e5b Mon Sep 17 00:00:00 2001 From: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@sprout-oss.stage.blox.sqprod.co> Date: Sun, 21 Jun 2026 10:04:25 -0400 Subject: [PATCH] desktop: document the reaction-rollback race as an accepted edge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Tyler Longwell --- desktop/src/features/messages/hooks.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/desktop/src/features/messages/hooks.ts b/desktop/src/features/messages/hooks.ts index 478878b939..4f1288c9b5 100644 --- a/desktop/src/features/messages/hooks.ts +++ b/desktop/src/features/messages/hooks.ts @@ -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( context.queryKey, context.previous,