Skip to content

fix(ClaimableBalanceCard): remove claimed rows and surface claim errors - #517

Open
Sam-Rytech wants to merge 1 commit into
Sorokit:mainfrom
Sam-Rytech:fix/441-claimable-balance-refresh
Open

fix(ClaimableBalanceCard): remove claimed rows and surface claim errors#517
Sam-Rytech wants to merge 1 commit into
Sorokit:mainfrom
Sam-Rytech:fix/441-claimable-balance-refresh

Conversation

@Sam-Rytech

Copy link
Copy Markdown
Contributor

Closes #441

After a successful claim the row was only flagged with a "Claimed" badge. The list was never updated, so the balance came straight back on the next mount or refresh because the card re-fetches the full list from the server.

  • BalanceRow now reports a successful claim upward via onClaimed(id), and ClaimableBalanceCard removes that balance from balances immediately (optimistic update).
  • A post-claim re-fetch keeps the list server-consistent; claimed ids are tracked in a ref and filtered out of the response so a lagging server cannot resurrect the row. The refresh is a background one, so the card does not flash its loading skeleton.
  • Failed claims render an inline role="alert" message on the affected row, wrapped instead of truncated, and the button returns to its normal state so the user can retry.
  • claimBalance, getClaimableBalances and clipboard writes are all caught, so a rejection can no longer escape as an unhandled promise rejection or pin the card in its loading state.

Tests: the existing suite still mocked the removed getClient entrypoint (the client moved to SorokitContext), so the mocks are updated to the hook and the claim-flow cases now assert row removal, inline errors, retry and rejection handling.

Closes Sorokit#441

After a successful claim the row was only flagged with a "Claimed" badge.
The list was never updated, so the balance came straight back on the next
mount or refresh because the card re-fetches the full list from the server.

- BalanceRow now reports a successful claim upward via `onClaimed(id)`, and
  ClaimableBalanceCard removes that balance from `balances` immediately
  (optimistic update).
- A post-claim re-fetch keeps the list server-consistent; claimed ids are
  tracked in a ref and filtered out of the response so a lagging server
  cannot resurrect the row. The refresh is a background one, so the card
  does not flash its loading skeleton.
- Failed claims render an inline `role="alert"` message on the affected row,
  wrapped instead of truncated, and the button returns to its normal state
  so the user can retry.
- claimBalance, getClaimableBalances and clipboard writes are all caught, so
  a rejection can no longer escape as an unhandled promise rejection or pin
  the card in its loading state.

Tests: the existing suite still mocked the removed `getClient` entrypoint
(the client moved to SorokitContext), so the mocks are updated to the hook
and the claim-flow cases now assert row removal, inline errors, retry and
rejection handling.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@Sam-Rytech Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ClaimableBalanceCard does not refresh or remove a row after a successful claim

1 participant