Skip to content

feat: Optimistic UI for register/claim with rollback #627

@joelpeace48-cell

Description

@joelpeace48-cell

Background & current state

On register/claim the UI waits on chain confirmation with little immediate feedback (TransactionStatus.jsx shows status, but state isn't optimistic). This feels slow.

Goal

Add optimistic UI for register/claim: reflect the expected state immediately on submit, then confirm or roll back on result.

Technical design

  • On submit, optimistically update local state (e.g., "registered", balance change); on confirmation, reconcile with chain truth; on failure, roll back + show a mapped error (errorMapping.js).
  • Guard against double-submit; show pending indicators.

Edge cases

  • Tx fails after optimistic update → clean rollback to correct state.
  • Slow confirmation → keep pending UI, allow cancel where possible.
  • Concurrent actions → consistent reconciliation.
  • Network/RPC error vs contract revert → distinct messaging.

Task breakdown

  • Optimistic update + reconcile/rollback for register + claim.
  • Double-submit guard + pending UI.
  • Error-class-specific rollback messaging.
  • E2E forcing a failure (assert rollback).

Acceptance criteria

  • Successful actions feel instant; failed actions roll back to the correct state with a clear error.

Testing & verification

  • E2E forcing tx failure → rollback; success path reconciliation.

Out of scope

  • Backend changes.

Dependencies / related

  • Uses errorMapping.js/TransactionStatus.jsx; pairs with NEW-108.

Difficulty: medium · Effort: M

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions