Repository navigation
fix(AccountCard): add clipboard error handling and memoize avatar hashing (#889) - #1009
Merged
k-deejah merged 4 commits intoOct 18, 2026
Merged
Conversation
…hing (Sorokit#889) - Wrap clipboard writing with document.execCommand('copy') fallback and display error toast upon failure - Add onCopyError callback support to AddressDisplay and wire into AccountCard - Generate deterministic avatar gradients using full-address FNV-1a hashing to prevent prefix collisions - Memoize avatar initials and gradient styles using useMemo to prevent recomputation on non-account prop changes - Add unit tests covering clipboard failure, error toast triggering, avatar gradient memoization, and prefix collision avoidance
|
@bamiebot-maker 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Resolves #889.
Problem
src/components/AccountCard.tsx(AccountCard), the copy-to-clipboard button silently failed without visual feedback whennavigator.clipboard.writeTextrejected in non-HTTPS or permission-restricted environments.Solution & Implementation
AddressDisplaywith anonCopyErrorcallback invoked when bothnavigator.clipboard.writeTextanddocument.execCommand('copy')fail.copyToClipboardfallback utility handling synchronous and asynchronous clipboard rejection.onCopyErrorinAccountCardto display an error toast ("Copy Failed": "Failed to copy address to clipboard.").fnv1aHash) that evaluates every character of the full public key string, guaranteeing distinct hashes and gradient palettes for accounts that share identical prefixes.AccountCardandAccountCardCompactusinguseMemo(..., [address]), preventing style recalculation when non-account props (e.g.onNavigate) change.src/components/AccountCard.test.tsxverifying:copyToClipboardfallback behavior across modern Clipboard API andexecCommand.Acceptance Criteria Checklist