mirror of
https://github.com/block/buzz.git
synced 2026-11-03 16:01:35 +00:00
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:
parent
d93c7d78f8
commit
b089618dd0
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user